Implement safe storage utility and update i18n handling to use it

This commit is contained in:
alam00000 committed 2026-08-14 15:13:42 +05:30
1 parent e1a4a31458
commit 706e74f084
4 files changed
+104 -13

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
export const getStoredItem = (key: string): string | null => {
try {
return localStorage.getItem(key);
} catch {
return null;
}
};
export const setStoredItem = (key: string, value: string): boolean => {
try {
localStorage.setItem(key, value);
return true;
} catch {
return false;
}
};
export const removeStoredItem = (key: string): boolean => {
try {
localStorage.removeItem(key);
return true;
} catch {
return false;
}
};