fixed data
This commit is contained in:
1 parent
eaa5cc0065
commit
54f4e991a3
5 files changed
+47
-29
No files matched your search
@@ -0,0 +1,18 @@
|
||||
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'));
|
||||
}
|
||||
|
||||
export function getPlayers(): Player[] {
|
||||
const players = localStorage.getItem(PREF.players);
|
||||
if (players === null) {
|
||||
return [];
|
||||
}
|
||||
return JSON.parse(players);
|
||||
}
|
||||
Reference in new issue
Block a user