Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcdj-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
971be918
authored
2023-06-02 10:08:18 +0800
by
renchao@pashanhoo.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:cas配置
1 parent
c78c3b0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
src/utils/request.js
src/utils/request.js
View file @
971be91
/*
* @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器
* @Autor: renchao
* @LastEditTime: 2023-06-0
1 16:05:00
* @LastEditTime: 2023-06-0
2 10:07:55
*/
import
axios
from
'axios'
import
Cookies
from
'js-cookie'
...
...
@@ -32,6 +32,14 @@ service.interceptors.request.use(
}
else
{
config
.
headers
.
delete
(
'Authorization'
)
}
}
else
{
const
token
=
Cookies
.
get
(
'token'
)
// 添加请求头
if
(
token
)
{
config
.
headers
[
'Authorization'
]
=
'Bearer '
+
token
}
else
{
config
.
headers
.
delete
(
'Authorization'
)
}
}
return
config
},
...
...
Please
register
or
sign in
to post a comment