|
@@ -14,11 +14,9 @@ const setDict = (type, val, cacheTime) => {
|
|
|
|
|
|
export const getDict = (type) => {
|
|
|
return new Promise((resolve) => {
|
|
|
- const catchData = localStorage.getItem(type)
|
|
|
- if (!catchData) {
|
|
|
- return
|
|
|
- }
|
|
|
- if (catchData.expire && (Date.now() <= catchData.expire)) {
|
|
|
+ const item = localStorage.getItem(type)
|
|
|
+ const catchData = item ? JSON.parse(item) : null
|
|
|
+ if (catchData && catchData.expire && (Date.now() <= catchData.expire)) {
|
|
|
return resolve(catchData.data)
|
|
|
}
|
|
|
// 传参按照规范参数传
|