Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cdsf-static-bg
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜雷
cdsf-static-bg
Commits
4ce66a95
Commit
4ce66a95
authored
Oct 15, 2018
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理token过期登出
parent
a42f6dea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
fetch.js
src/api/fetch.js
+1
-1
index.js
src/store/modules/user/index.js
+7
-1
No files found.
src/api/fetch.js
View file @
4ce66a95
...
@@ -56,7 +56,7 @@ service.interceptors.response.use(response => {
...
@@ -56,7 +56,7 @@ service.interceptors.response.use(response => {
});
});
// -2:其他客户端登录了;Token 过期了;
// -2:其他客户端登录了;Token 过期了;
if
(
res
.
code
===
'-2'
)
{
if
(
res
.
code
===
-
2
)
{
if
(
logout
)
return
;
if
(
logout
)
return
;
logout
=
true
;
logout
=
true
;
MessageBox
.
confirm
(
MessageBox
.
confirm
(
...
...
src/store/modules/user/index.js
View file @
4ce66a95
...
@@ -53,7 +53,13 @@ const actions = {
...
@@ -53,7 +53,13 @@ const actions = {
// 登出
// 登出
LogOut
({
commit
,
state
})
{
LogOut
({
commit
,
state
})
{
return
logout
(
state
.
token
).
then
(()
=>
{
return
logout
(
state
.
token
)
.
then
(()
=>
{
commit
(
SET_TOKEN
,
''
);
removeToken
();
})
.
catch
(
err
=>
{
console
.
log
(
err
);
commit
(
SET_TOKEN
,
''
);
commit
(
SET_TOKEN
,
''
);
removeToken
();
removeToken
();
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment