mirror of
https://github.com/vibegif/vibegif.lol.git
synced 2026-04-07 02:12:12 +00:00
Fix: Harden localStorage reads against corruption
This commit is contained in:
@@ -1,7 +1,12 @@
|
|||||||
export const STORAGE_KEY = 'vibegif_api_key';
|
export const STORAGE_KEY = 'vibegif_api_key';
|
||||||
|
|
||||||
export function getApiKey() {
|
export function getApiKey() {
|
||||||
|
try {
|
||||||
return localStorage.getItem(STORAGE_KEY) || '';
|
return localStorage.getItem(STORAGE_KEY) || '';
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('localStorage read failed:', e);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setApiKey(key) {
|
export function setApiKey(key) {
|
||||||
|
|||||||
Reference in New Issue
Block a user