1
0
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:
2020-06-11 22:41:02 -05:00
parent b7d13ee5fd
commit 58170df201
18 changed files with 3040 additions and 2307 deletions

View File

@@ -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,
};