mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-18 01:06:39 +08:00
25 lines
534 B
JavaScript
25 lines
534 B
JavaScript
/* eslint-disable no-constant-condition */
|
|
/**
|
|
* storage handler
|
|
*/
|
|
|
|
const SessionUserKey = 'LOGIN_USER';
|
|
export const Global = {}
|
|
|
|
export function getSessionId() {
|
|
const user = getLoginUser();
|
|
return user ? user['session_id'] : '';
|
|
}
|
|
|
|
export function getLoginUser() {
|
|
const value = sessionStorage.getItem(SessionUserKey);
|
|
if (value) {
|
|
return JSON.parse(value);
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export function setLoginUser(user) {
|
|
sessionStorage.setItem(SessionUserKey, JSON.stringify(user))
|
|
} |