fix: incompatible with old data of userInfo, causing crash
This commit is contained in:
parent
7e49ec210e
commit
d5ced0718f
1 changed files with 8 additions and 1 deletions
|
@ -56,7 +56,14 @@ export const IndexDBStorageImpl = IndexDBStorageExtern.impl({
|
||||||
|
|
||||||
export const BrowserSyncStorageImpl = BrowserSyncStorageExtern.impl({
|
export const BrowserSyncStorageImpl = BrowserSyncStorageExtern.impl({
|
||||||
name: STORAGE_NAME,
|
name: STORAGE_NAME,
|
||||||
get: async (key) => JSONR.parse(await browserSyncStorage.getItem(key)),
|
get: async (key) => {
|
||||||
|
const value: any = await browserSyncStorage.getItem(key)
|
||||||
|
try {
|
||||||
|
return JSONR.parse(value)
|
||||||
|
} catch {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
},
|
||||||
set: (key, value) => browserSyncStorage.setItem(key, JSONR.stringify(value)),
|
set: (key, value) => browserSyncStorage.setItem(key, JSONR.stringify(value)),
|
||||||
remove: browserSyncStorage.removeItem,
|
remove: browserSyncStorage.removeItem,
|
||||||
clear: browserSyncStorage.clear,
|
clear: browserSyncStorage.clear,
|
||||||
|
|
Loading…
Reference in a new issue