Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2022-05-06 12:07:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
71156e708dc4f17dfaa938a2328aaac10fe4c434
71156e70
1 parent
734dcabe
fix 封装axios请求头
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
src/utils/axios.js
src/utils/axios.js
View file @
71156e7
import
axios
from
'axios'
;
import
router
from
'../router'
;
import
_
from
'lodash'
import
qs
from
'Qs'
// 请求拦截器
axios
.
interceptors
.
request
.
use
(
config
=>
{
// 发送请求前
if
(
config
.
method
===
'post'
)
{
// POST PHP需要修改数据格式
config
.
data
=
qs
.
stringify
(
config
.
data
)
}
// 绑定默认请求头
config
.
params
=
_
.
merge
(
config
.
params
,
{
f
:
'voice'
,
client_id
:
'313939'
,
client_id
:
'313939'
})
return
config
;
},
...
...
Please
register
or
login
to post a comment