2021-01-16 22:15:10 +08:00
|
|
|
function ccn_localstorageAssist_Get(index, defaultValue) {
|
|
|
|
|
var cache = localStorage.getItem(index);
|
|
|
|
|
if (cache == null) {
|
|
|
|
|
ccn_localstorageAssist_Set(index, defaultValue);
|
|
|
|
|
return defaultValue;
|
|
|
|
|
} else return cache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ccn_localstorageAssist_Set(index, value) {
|
|
|
|
|
localStorage.setItem(index, value);
|
2021-03-08 15:41:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =================================== seperated data getter setter
|
|
|
|
|
|
|
|
|
|
function ccn_localstorageAssist_GetApiToken() {
|
|
|
|
|
return ccn_localstorageAssist_Get('ccn-token', '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ccn_localstorageAssist_SetApiToken(value) {
|
|
|
|
|
ccn_localstorageAssist_Set('ccn-token', value);
|
|
|
|
|
}
|