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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
fetch.js
src/api/fetch.js
+1
-1
index.js
src/store/modules/user/index.js
+10
-4
No files found.
src/api/fetch.js
View file @
4ce66a95
...
...
@@ -56,7 +56,7 @@ service.interceptors.response.use(response => {
});
// -2:其他客户端登录了;Token 过期了;
if
(
res
.
code
===
'-2'
)
{
if
(
res
.
code
===
-
2
)
{
if
(
logout
)
return
;
logout
=
true
;
MessageBox
.
confirm
(
...
...
src/store/modules/user/index.js
View file @
4ce66a95
...
...
@@ -53,10 +53,16 @@ const actions = {
// 登出
LogOut
({
commit
,
state
})
{
return
logout
(
state
.
token
).
then
(()
=>
{
commit
(
SET_TOKEN
,
''
);
removeToken
();
});
return
logout
(
state
.
token
)
.
then
(()
=>
{
commit
(
SET_TOKEN
,
''
);
removeToken
();
})
.
catch
(
err
=>
{
console
.
log
(
err
);
commit
(
SET_TOKEN
,
''
);
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