diff --git a/src/utils/utils.js b/src/utils/utils.js new file mode 100644 index 0000000..b899baa --- /dev/null +++ b/src/utils/utils.js @@ -0,0 +1,16 @@ +export const hasLocalStorage = () => { + try { + var ls = localStorage; + var key = "__test"; + ls.setItem(key, key); + ls.removeItem(key); + return true; + } catch (e) { + return ( + e instanceof DOMException && + e.name === "QuotaExceededError" && + localStorage && + localStorage.length !== 0 + ); + } +} \ No newline at end of file