提交 | 用户 | age
|
2a61f6
|
1 |
|
L |
2 |
// token |
|
3 |
const TokenKey = 'adminToken' |
|
4 |
export function getToken() { |
|
5 |
return sessionStorage.getItem(TokenKey) |
|
6 |
} |
|
7 |
|
|
8 |
export function setToken(token) { |
|
9 |
return sessionStorage.setItem(TokenKey, token) |
|
10 |
} |
|
11 |
|
|
12 |
export function removeToken() { |
|
13 |
return sessionStorage.removeItem(TokenKey) |
|
14 |
} |
|
15 |
|
|
16 |
// userData |
|
17 |
const userDataKey = 'userData' |
|
18 |
export function getUserData() { |
|
19 |
return sessionStorage.getItem(userDataKey) |
|
20 |
} |
|
21 |
|
|
22 |
export function setUserData(data) { |
|
23 |
return sessionStorage.setItem(userDataKey, JSON.stringify(data)) |
|
24 |
} |
|
25 |
|
|
26 |
export function removeUserData() { |
|
27 |
return sessionStorage.removeItem(userDataKey) |
|
28 |
} |