Implement safe storage utility and update i18n handling to use it

This commit is contained in:
alam00000
2026-08-14 15:13:42 +05:30
parent e1a4a31458
commit 706e74f084
4 changed files with 104 additions and 13 deletions
+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;
}
};