修改登录缓存
This commit is contained in:
parent
b2db32f018
commit
a983b7b476
@ -2,7 +2,8 @@ export function getCache(name) {
|
||||
if (name == undefined || name == "") {
|
||||
return "";
|
||||
}
|
||||
let result = localStorage.getItem(name);
|
||||
//let result = localStorage.getItem(name);
|
||||
let result = sessionStorage.getItem(name);
|
||||
if (result!= null) {
|
||||
if ((result.startsWith("{") && result.endsWith("}")) || (result.startsWith("[") && result.endsWith("]"))) {
|
||||
result = JSON.parse(result);
|
||||
@ -18,9 +19,11 @@ export function getCache(name) {
|
||||
if(typeof value === 'object') {
|
||||
value = JSON.stringify(value);
|
||||
}
|
||||
let result = localStorage.setItem(name, value);
|
||||
//let result = localStorage.setItem(name, value);
|
||||
let result = sessionStorage.setItem(name, value);
|
||||
return result;
|
||||
}
|
||||
export function clearStorage() {
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
//localStorage.clear();
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user