mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-11 09:32:50 +00:00
feat: add favorites - update dependencies
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { SoundType } from '../model';
|
||||
|
||||
const clear = () => {
|
||||
localStorage.clear();
|
||||
};
|
||||
@@ -10,8 +12,19 @@ const getJWT = (): string | null => {
|
||||
return localStorage.getItem('jwt');
|
||||
};
|
||||
|
||||
const getFavorites = (): SoundType[] => {
|
||||
const f = localStorage.getItem('favorites');
|
||||
return f ? JSON.parse(f) : [];
|
||||
};
|
||||
|
||||
const setFavorites = (f: SoundType[]): void => {
|
||||
localStorage.setItem('favorites', JSON.stringify(f));
|
||||
};
|
||||
|
||||
export const StorageService = {
|
||||
clear,
|
||||
getJWT,
|
||||
setJWT,
|
||||
getFavorites,
|
||||
setFavorites,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user