Fix: Harden localStorage reads against corruption

This commit is contained in:
2026-03-21 01:42:29 -07:00
parent 870a1fb3a9
commit 93f0725d37

View File

@@ -1,7 +1,12 @@
export const STORAGE_KEY = 'vibegif_api_key';
export function getApiKey() {
return localStorage.getItem(STORAGE_KEY) || '';
try {
return localStorage.getItem(STORAGE_KEY) || '';
} catch (e) {
console.warn('localStorage read failed:', e);
return '';
}
}
export function setApiKey(key) {