Commit 09c343c3 authored by GuanHua's avatar GuanHua

fix: 获取顶域带端口问题修复

parent 3d3fcb6d
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