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
dee8c762
authored
2023-06-01 09:21:22 +0800
by
renchao@pashanhoo.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:token设置
1 parent
1a2d8aba
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
src/utils/request.js
src/utils/request.js
View file @
dee8c76
/*
* @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器
* @Autor: renchao
* @LastEditTime: 2023-0
5-31 15:30:02
* @LastEditTime: 2023-0
6-01 09:20:24
*/
import
axios
from
'axios'
import
{
Message
}
from
'element-ui'
...
...
@@ -38,7 +38,7 @@ service.interceptors.request.use(
return
Promise
.
reject
(
error
);
}
)
window
.
__isNeedLogin
=
true
// response interceptor
service
.
interceptors
.
response
.
use
(
response
=>
{
...
...
@@ -60,7 +60,7 @@ service.interceptors.response.use(
//todo: 需要解决 一个页面多个请求,刷新后此处会触发多次
if
(
window
.
__isNeedLogin
)
{
window
.
__isNeedLogin
=
false
this
.
$m
essage
.
error
(
'token失效,请重新登录'
);
M
essage
.
error
(
'token失效,请重新登录'
);
let
locationUrl
=
window
.
location
.
protocol
+
'//'
+
window
.
location
.
host
+
window
.
location
.
pathname
;
localStorage
.
removeItem
(
'token'
)
if
(
window
.
_config
.
casEnable
)
{
...
...
Please
register
or
sign in
to post a comment