Commit 09df93ae authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents 5d283360 f57fb3b9
import { isDev, TOP_DOMAIN } from '@/constants'
import { TOP_DOMAIN_NO_PORT, TOP_DOMAIN } from '@/constants'
import { GetMemberLoginRegetResponse } from '@/services/MemberV2Api'
import { getTopDomainByHost } from '.'
import { getCookie, removeCookie, setCookie } from './cookie'
......@@ -33,8 +33,8 @@ export const setAuth = (info: AuthInfo) => {
memberRoleId: info.memberRoleId,
memberType: info.memberType,
}
setCookie(AUTH_KEY, JSON.stringify(auth), { domain: TOP_DOMAIN})
setCookie(AUTH_ROLES_KEY, JSON.stringify(info.roles), { domain: TOP_DOMAIN })
setCookie(AUTH_KEY, JSON.stringify(auth), { domain: TOP_DOMAIN_NO_PORT})
setCookie(AUTH_ROLES_KEY, JSON.stringify(info.roles), { domain: TOP_DOMAIN_NO_PORT })
setLocalAuth(info)
setRouters(info.urls)
}
......@@ -96,8 +96,8 @@ export const removeRouters = () => {
}
export const removeAuth = () => {
removeCookie(AUTH_KEY, { path: '/', domain: getTopDomainByHost(TOP_DOMAIN, true) })
removeCookie(AUTH_ROLES_KEY, { path: '/', domain: getTopDomainByHost(TOP_DOMAIN, true) })
removeCookie(AUTH_KEY, { path: '/', domain: getTopDomainByHost(TOP_DOMAIN_NO_PORT, true) })
removeCookie(AUTH_ROLES_KEY, { path: '/', domain: getTopDomainByHost(TOP_DOMAIN_NO_PORT, true) })
window.localStorage.removeItem(AUTH_KEY)
removeRouters()
const _window: any = window
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment