| | |
| | | const domainPrefix = subDomainName ? `${subDomainName}-` : ''; |
| | | return domainPrefix; |
| | | }; |
| | | export const domainPrefix = getDomainPrefix(window); |
| | | |
| | | // token 键定义 |
| | | const sessionName = 'access-session'; |
| | |
| | | phoneNumber?: string; |
| | | }; |
| | | |
| | | const getDomainKey = (suffix: string) => getDomainPrefix() + suffix; |
| | | const getDomainKey = (suffix: string) => suffix; |
| | | |
| | | export const accessSessionKey = getDomainKey(sessionName); |
| | | export const userInfoKey = getDomainKey(userInfoName); |
| | |
| | | |
| | | |
| | | import { domainPrefix } from './request'; |
| | | /** |
| | | * window.localStorage 浏览器永久缓存 |
| | | * @method set 设置永久缓存 |
| | |
| | | // 查看 v2.4.3版本更新日志 |
| | | setKey(key: string) { |
| | | // @ts-ignore |
| | | return `${__NEXT_NAME__}:${key}`; |
| | | }, |
| | | return `${__NEXT_NAME__}:${domainPrefix}${key}`; }, |
| | | // 设置永久缓存 |
| | | set<T>(key: string, val: T) { |
| | | window.localStorage.setItem(Local.setKey(key), JSON.stringify(val)); |