rt-sim-training-client/src/utils/auth.js

26 lines
707 B
JavaScript
Raw Normal View History

2019-07-05 10:18:17 +08:00
import SessionStorage from 'sessionstorage';
2019-07-02 16:29:52 +08:00
const TokenKey = 'Admin-Token';
2019-09-23 17:47:54 +08:00
2019-11-14 13:59:33 +08:00
// 设置教学实训仿真系统token, 设置城市轨道交通设计平台token
2019-07-02 16:29:52 +08:00
export function getToken() {
2019-11-05 16:40:36 +08:00
return SessionStorage.getItem(TokenKey);
2019-07-02 16:29:52 +08:00
}
export function setToken(token) {
2019-11-05 16:40:36 +08:00
return SessionStorage.setItem(TokenKey, token);
2019-07-02 16:29:52 +08:00
}
export function removeToken() {
2019-11-05 16:40:36 +08:00
return SessionStorage.removeItem(TokenKey);
2019-07-02 16:29:52 +08:00
}
// 操作sessionStorage
export function getSessionStorage(key) {
2019-11-05 16:40:36 +08:00
return SessionStorage.getItem(key);
}
export function setSessionStorage(key, value) {
2019-11-05 16:40:36 +08:00
return SessionStorage.setItem(key, value);
}
export function removeSessionStorage(key) {
2019-11-05 16:40:36 +08:00
return SessionStorage.removeItem(key);
2019-07-02 16:29:52 +08:00
}