Initial commit: Copilot Toolbox template project
This commit is contained in:
43
src/utils/cacheUtil.ts
Normal file
43
src/utils/cacheUtil.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
export function cacheGet(key: string): string {
|
||||
return localStorage.getItem(key) || ''
|
||||
}
|
||||
|
||||
export function cacheSet(key: string, value: string) {
|
||||
localStorage.setItem(key, value)
|
||||
}
|
||||
|
||||
export function cacheClear(key: string) {
|
||||
localStorage.removeItem(key)
|
||||
}
|
||||
|
||||
export function cacheDeleteAll() {
|
||||
localStorage.clear()
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
id?: string
|
||||
avatar?: string
|
||||
gender?: string
|
||||
nickName?: string
|
||||
username?: string
|
||||
position?: string
|
||||
deptName?: string
|
||||
mobile?: string
|
||||
bizMail?: string
|
||||
email?: string
|
||||
corpName?: string
|
||||
effectivePoint?: string
|
||||
totalPoint?: string
|
||||
}
|
||||
|
||||
export function getUserInfo(): UserInfo | null {
|
||||
const res = localStorage.getItem('userInfo')
|
||||
if (!res) {
|
||||
return null
|
||||
} else {
|
||||
return JSON.parse(res)
|
||||
}
|
||||
}
|
||||
export function getToken() {
|
||||
return localStorage.getItem('token')
|
||||
}
|
||||
Reference in New Issue
Block a user