mirror of
https://github.com/vibegif/vibegif.lol.git
synced 2026-04-07 18:22:13 +00:00
Refactor: Isolate API key storage
This commit is contained in:
13
src/core/storage.js
Normal file
13
src/core/storage.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
export const STORAGE_KEY = 'vibegif_api_key';
|
||||||
|
|
||||||
|
export function getApiKey() {
|
||||||
|
return localStorage.getItem(STORAGE_KEY) || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setApiKey(key) {
|
||||||
|
localStorage.setItem(STORAGE_KEY, (key || '').trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasApiKey() {
|
||||||
|
return !!getApiKey();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user