yuang-framework-ui-common 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utils/storageUtils.ts +12 -0
- package/package.json +1 -1
@@ -50,7 +50,13 @@ const getSessionStorageItem = (key) => {
|
|
50
50
|
return null;
|
51
51
|
}
|
52
52
|
const value = sessionStorage.getItem(key);
|
53
|
+
if(!value) {
|
54
|
+
return null;
|
55
|
+
}
|
53
56
|
const data = JSON.parse(value);
|
57
|
+
if(!data || !data.value) {
|
58
|
+
return null;
|
59
|
+
}
|
54
60
|
return data.value;
|
55
61
|
}
|
56
62
|
|
@@ -115,7 +121,13 @@ const getLocalStorageItem = (key) => {
|
|
115
121
|
return null;
|
116
122
|
}
|
117
123
|
const value = localStorage.getItem(key);
|
124
|
+
if(!value) {
|
125
|
+
return null;
|
126
|
+
}
|
118
127
|
const data = JSON.parse(value);
|
128
|
+
if(!data || !data.value) {
|
129
|
+
return null;
|
130
|
+
}
|
119
131
|
return data.value;
|
120
132
|
}
|
121
133
|
|