🚧 Removed hard check on local storage support
This commit is contained in:
parent
bfd035b53a
commit
e1c4745df3
1 changed files with 10 additions and 7 deletions
|
@ -1,8 +1,9 @@
|
||||||
const storage = {
|
const storage = {
|
||||||
set: (key, value, raw) => {
|
set: (key, value, raw) => {
|
||||||
if (typeof localStorage === "undefined")
|
if (typeof localStorage === "undefined") {
|
||||||
throw(new Error("No localStorage support. And we need it. Bailing out."));
|
console.log("Warning: No localStorage support");
|
||||||
|
return value;
|
||||||
|
}
|
||||||
const _key = "fs_" + key;
|
const _key = "fs_" + key;
|
||||||
|
|
||||||
if (typeof value === "undefined" || value === null)
|
if (typeof value === "undefined" || value === null)
|
||||||
|
@ -12,13 +13,15 @@ const storage = {
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
get: (key, raw) => {
|
get: (key, raw) => {
|
||||||
if (typeof localStorage === "undefined")
|
if (typeof localStorage === "undefined") {
|
||||||
throw(new Error("No localStorage support. And we need it. Bailing out."));
|
console.log("Warning: No localStorage support");
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
const value = localStorage.getItem("fs_" + key);
|
const value = localStorage.getItem("fs_" + key);
|
||||||
|
|
||||||
return raw ? value : JSON.parse(value);
|
return raw ? value : JSON.parse(value);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export default storage;
|
export default storage;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue