Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
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
shenshaokai
jinfa-platform
Commits
cea42e18
Commit
cea42e18
authored
Apr 14, 2022
by
Bill
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-v2-220418' into 'v2-220418'
chore: 修改urls获取方法 See merge request linkseeks-design/pro-platform!281
parents
02c4709a
2aa3c0a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
auth.ts
src/utils/auth.ts
+15
-3
No files found.
src/utils/auth.ts
View file @
cea42e18
...
...
@@ -22,6 +22,14 @@ export interface AuthInfo extends GetMemberLoginRegetResponse {
const
AUTH_KEY
=
'AUTH'
const
AUTH_ROLES_KEY
=
'AUTH_ROLES'
const
getUrls
=
(
auths
:
AuthInfo
[
'auth'
]):
string
[]
=>
{
if
(
!
Array
.
isArray
(
auths
))
{
return
[]
}
return
auths
.
map
((
item
)
=>
item
.
u
)
}
export
const
setAuth
=
(
info
:
AuthInfo
)
=>
{
const
auth
=
{
userId
:
info
.
userId
,
...
...
@@ -37,10 +45,14 @@ export const setAuth = (info: AuthInfo) => {
memberType
:
info
.
memberType
,
locales
:
info
.
locales
,
}
const
compoundedInfo
:
AuthInfo
=
{
...
info
,
urls
:
getUrls
(
info
.
auth
),
}
setCookie
(
AUTH_KEY
,
JSON
.
stringify
(
auth
),
{
domain
:
TOP_DOMAIN_NO_PORT
})
setCookie
(
AUTH_ROLES_KEY
,
JSON
.
stringify
(
i
nfo
.
roles
),
{
domain
:
TOP_DOMAIN_NO_PORT
})
setLocalAuth
(
i
nfo
)
setRouters
(
i
nfo
.
auth
)
setCookie
(
AUTH_ROLES_KEY
,
JSON
.
stringify
(
compoundedI
nfo
.
roles
),
{
domain
:
TOP_DOMAIN_NO_PORT
})
setLocalAuth
(
compoundedI
nfo
)
setRouters
(
compoundedI
nfo
.
auth
)
}
/**
...
...
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