summaryrefslogtreecommitdiffstats
path: root/src/services
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-18 22:40:59 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-18 22:40:59 +0200
commit584bd42f871d2e1618ca414749f09c38f0143a44 (patch)
tree45c821eec2ad9c77d5bccf83057cfc0a7e22ba09 /src/services
parentb214baab3e17d92f784b4f782863deafc5558ee4 (diff)
chore: handle settings change
Diffstat (limited to 'src/services')
-rw-r--r--src/services/local-storage/index.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/services/local-storage/index.ts b/src/services/local-storage/index.ts
index 8ed9ebf..65235a7 100644
--- a/src/services/local-storage/index.ts
+++ b/src/services/local-storage/index.ts
@@ -1,15 +1,15 @@
export const LocalStorage = {
- get(key: string): string | null | undefined {
+ get<T>(key: string): T | undefined {
try {
const serialItem = localStorage.getItem(key);
if (!serialItem) return undefined;
- return JSON.parse(serialItem);
+ return JSON.parse(serialItem) as T;
} catch (e) {
console.log(e);
return undefined;
}
},
- set(key: string, value: string) {
+ set<T>(key: string, value: T) {
try {
const serialItem = JSON.stringify(value);
localStorage.setItem(key, serialItem);