mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-12 04:03:42 +08:00
优化登录逻辑
This commit is contained in:
@@ -3,13 +3,23 @@
|
||||
* storage handler
|
||||
*/
|
||||
|
||||
const SessionIdKey = 'ChatGPT_SESSION_ID';
|
||||
const SessionUserKey = 'LOGIN_USER';
|
||||
export const Global = {}
|
||||
|
||||
export function getSessionId() {
|
||||
return sessionStorage.getItem(SessionIdKey)
|
||||
const user = getLoginUser();
|
||||
return user ? user['session_id'] : '';
|
||||
}
|
||||
|
||||
export function setSessionId(value) {
|
||||
sessionStorage.setItem(SessionIdKey, value)
|
||||
export function getLoginUser() {
|
||||
const value = sessionStorage.getItem(SessionUserKey);
|
||||
if (value) {
|
||||
return JSON.parse(value);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function setLoginUser(value) {
|
||||
sessionStorage.setItem(SessionUserKey, JSON.stringify(value))
|
||||
}
|
||||
Reference in New Issue
Block a user