holy shit
This commit is contained in:
1 parent
a526a24e7c
commit
b5e5cc502d
20 files changed
+286
-209
No files matched your search
@@ -1,9 +1,6 @@
|
||||
import { Player } from "@/types/player";
|
||||
import { PREF } from "./const";
|
||||
|
||||
export const MAX_POINTS = 10000;
|
||||
export const MIN_POINTS = 0;
|
||||
|
||||
export function setPlayers(players: Player[]) {
|
||||
localStorage.setItem(PREF.players, JSON.stringify(players));
|
||||
window.dispatchEvent(new Event('storage'));
|
||||
@@ -14,5 +11,9 @@ export function getPlayers(): Player[] {
|
||||
if (players === null) {
|
||||
return [];
|
||||
}
|
||||
return JSON.parse(players);
|
||||
try {
|
||||
return JSON.parse(players);
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user