Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
罗鑫霖
/
vion-tools
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9c20949a
authored
May 11, 2022
by
李君
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
atoken失效重新登录
1 parent
ee70e377
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
src/Request/PublicAxiosInstance.js
src/Request/PublicAxiosInstance.js
View file @
9c20949
...
@@ -15,6 +15,20 @@ axiosInstance.interceptors.request.use(
...
@@ -15,6 +15,20 @@ axiosInstance.interceptors.request.use(
config
=>
{
config
=>
{
// Cookies.set('atoken','90eeca8f-7d7e-4dfa-8d7b-468e033dd048')
// Cookies.set('atoken','90eeca8f-7d7e-4dfa-8d7b-468e033dd048')
if
(
!
Cookies
.
get
(
'atoken'
)){
ElMessage
({
message
:
`登录过期,请重新登录`
,
type
:
'warning'
})
setTimeout
(()
=>
{
let
url
=
[
'localhost'
,
'192.168.1.174'
].
includes
(
window
.
location
.
hostname
)
?
'http://36.112.68.214:33333/'
:
window
.
location
.
origin
if
(
url
.
includes
(
'36.112.68.214'
)){
url
=
'http://36.112.68.214:33333/'
}
window
.
location
.
href
=
url
;
},
300
)
return
}
config
.
headers
.
Authorization
=
Cookies
.
get
(
'atoken'
)
config
.
headers
.
Authorization
=
Cookies
.
get
(
'atoken'
)
return
config
return
config
...
@@ -30,10 +44,13 @@ axiosInstance.interceptors.response.use(
...
@@ -30,10 +44,13 @@ axiosInstance.interceptors.response.use(
message
:
`登录过期,请重新登录`
,
message
:
`登录过期,请重新登录`
,
type
:
'warning'
type
:
'warning'
})
})
// setTimeout(()=>{
setTimeout
(()
=>
{
// let url = ['localhost', '192.168.1.174'].includes(window.location.hostname) ? 'http://36.112.68.214:33333/' : window.location.origin
let
url
=
[
'localhost'
,
'192.168.1.174'
].
includes
(
window
.
location
.
hostname
)
?
'http://36.112.68.214:33333/'
:
window
.
location
.
origin
// window.location.href=url;
if
(
url
.
includes
(
'36.112.68.214'
)){
// },300)
url
=
'http://36.112.68.214:33333/'
}
window
.
location
.
href
=
url
;
},
300
)
return
return
}
}
return
responseData
return
responseData
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment