Client: Safeguard against missing localStorage

This commit is contained in:
Donkie
2023-07-06 19:56:54 +02:00
parent 30934842ff
commit 04a39dfcbe
2 changed files with 21 additions and 4 deletions

View File

@@ -0,0 +1,12 @@
function _isLocalStorageAvailable(): boolean {
try {
localStorage.setItem('test', 'test');
localStorage.removeItem('test');
return true;
} catch (e) {
return false;
}
}
export const isLocalStorageAvailable = _isLocalStorageAvailable();