Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sean King
admin-fe
Commits
76f40174
Commit
76f40174
authored
7 years ago
by
Pan
Browse files
Options
Downloads
Patches
Plain Diff
fix: fix getUserInfo by cookie bug
parent
87a44ae7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mock/login.js
+1
-1
1 addition, 1 deletion
src/mock/login.js
src/permission.js
+2
-0
2 additions, 0 deletions
src/permission.js
src/store/modules/user.js
+3
-0
3 additions, 0 deletions
src/store/modules/user.js
with
6 additions
and
1 deletion
src/mock/login.js
+
1
−
1
View file @
76f40174
...
...
@@ -34,7 +34,7 @@ export default {
if
(
userMap
[
token
])
{
return
userMap
[
token
]
}
else
{
return
Promise
.
reject
(
'
error
'
)
return
false
}
},
logout
:
()
=>
'
success
'
...
...
This diff is collapsed.
Click to expand it.
src/permission.js
+
2
−
0
View file @
76f40174
...
...
@@ -3,6 +3,7 @@ import store from './store'
import
NProgress
from
'
nprogress
'
// Progress 进度条
import
'
nprogress/nprogress.css
'
// Progress 进度条样式
import
{
getToken
}
from
'
@/utils/auth
'
// 验权
import
{
Message
}
from
'
element-ui
'
// permissiom judge
function
hasPermission
(
roles
,
permissionRoles
)
{
...
...
@@ -29,6 +30,7 @@ router.beforeEach((to, from, next) => {
})
}).
catch
(()
=>
{
store
.
dispatch
(
'
FedLogOut
'
).
then
(()
=>
{
Message
.
error
(
'
验证失败,请重新登录
'
)
next
({
path
:
'
/login
'
})
})
})
...
...
This diff is collapsed.
Click to expand it.
src/store/modules/user.js
+
3
−
0
View file @
76f40174
...
...
@@ -63,6 +63,9 @@ const user = {
GetUserInfo
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getUserInfo
(
state
.
token
).
then
(
response
=>
{
if
(
!
response
.
data
)
{
// 由于mockjs 不支持自定义状态码只能这样hack
reject
(
'
error
'
)
}
const
data
=
response
.
data
commit
(
'
SET_ROLES
'
,
data
.
role
)
commit
(
'
SET_NAME
'
,
data
.
name
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment