fix: correct localstorage fallback
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
/* eslint-env browser */
|
/* eslint-env browser */
|
||||||
|
|
||||||
const storage = (() => {
|
const storage = (() => {
|
||||||
// return localstorage in the browser env
|
try {
|
||||||
if (this && this.localStorage) return this.localStorage;
|
return window.localStorage;
|
||||||
|
} catch (err) {
|
||||||
// return a mock localstorage in the server env
|
// return a mock localstorage in the server env
|
||||||
return {
|
return {
|
||||||
getItem: () => null,
|
getItem: () => null,
|
||||||
setItem: () => null,
|
setItem: () => null,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
Reference in New Issue
Block a user