|
@@ -3,17 +3,15 @@ import Cookies from 'js-cookie';
|
|
|
const TokenKey = 'GCLS_Token';
|
|
|
|
|
|
export function getToken() {
|
|
|
- return Cookies.get(TokenKey) ? Cookies.get(TokenKey) : sessionStorage.getItem(TokenKey);
|
|
|
+ return localStorage.getItem(TokenKey);
|
|
|
}
|
|
|
|
|
|
export function setToken (token) {
|
|
|
- sessionStorage.setItem(TokenKey, JSON.stringify(token));
|
|
|
- return Cookies.set(TokenKey, token);
|
|
|
+ return localStorage.setItem(TokenKey, JSON.stringify(token));
|
|
|
}
|
|
|
|
|
|
export function removeToken () {
|
|
|
- sessionStorage.removeItem(TokenKey)
|
|
|
- return Cookies.remove(TokenKey);
|
|
|
+ return localStorage.removeItem(TokenKey)
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -23,22 +21,20 @@ export function removeToken () {
|
|
|
* @returns {string} AccessToken - 访问令牌
|
|
|
*/
|
|
|
export function getAccessToken() {
|
|
|
- const token = Cookies.get(TokenKey)?JSON.parse(Cookies.get(TokenKey)):sessionStorage.getItem('GCLS_Token_Tc')?JSON.parse(sessionStorage.getItem('GCLS_Token_Tc')):null;
|
|
|
+ const token = localStorage.getItem(TokenKey)?JSON.parse(localStorage.getItem(TokenKey)):sessionStorage.getItem('GCLS_Token_Tc')?JSON.parse(sessionStorage.getItem('GCLS_Token_Tc')):null;
|
|
|
return { AccessToken: token?.access_token || '' };
|
|
|
}
|
|
|
|
|
|
const ConfigKey = 'GCLS_Config';
|
|
|
|
|
|
export function getConfig () {
|
|
|
- return Cookies.get(ConfigKey) ? Cookies.get(ConfigKey) : sessionStorage.getItem(ConfigKey);
|
|
|
+ return localStorage.getItem(ConfigKey);
|
|
|
}
|
|
|
|
|
|
export function setConfig(val) {
|
|
|
- sessionStorage.setItem(ConfigKey, JSON.stringify(val));
|
|
|
- return Cookies.set(ConfigKey, val);
|
|
|
+ return localStorage.setItem(ConfigKey, JSON.stringify(val));
|
|
|
}
|
|
|
|
|
|
export function removeConfig () {
|
|
|
- sessionStorage.removeItem(ConfigKey);
|
|
|
- return Cookies.remove(ConfigKey);
|
|
|
+ return localStorage.removeItem(ConfigKey);
|
|
|
}
|