refactor: change types from Map to Record in playerStore

This commit is contained in:
Kentai Radiquum 2024-12-05 18:12:48 +05:00
parent 2fb6fe47e0
commit 57245d99b7
Signed by: Radiquum
GPG key ID: 858E8EE696525EED

View file

@ -3,8 +3,8 @@ import { create } from "zustand";
import { persist } from "zustand/middleware"; import { persist } from "zustand/middleware";
interface userPlayerPreferencesState { interface userPlayerPreferencesState {
voiceover: Map<number, string>; voiceover: Record<number, string>;
player: Map<number, string>; player: Record<number, string>;
getPreferredVoiceover: (id: number) => (string | undefined); getPreferredVoiceover: (id: number) => (string | undefined);
setPreferredVoiceover: (id: number, voiceover: string) => void; setPreferredVoiceover: (id: number, voiceover: string) => void;
getPreferredPlayer: (id: number) => (string | undefined); getPreferredPlayer: (id: number) => (string | undefined);
@ -14,8 +14,8 @@ interface userPlayerPreferencesState {
export const useUserPlayerPreferencesStore = create<userPlayerPreferencesState>()( export const useUserPlayerPreferencesStore = create<userPlayerPreferencesState>()(
persist( persist(
(set, get) => ({ (set, get) => ({
voiceover: new Map<number, string>(), voiceover: {},
player: new Map<number, string>(), player: {},
getPreferredVoiceover: (id: number) => get().voiceover[id], getPreferredVoiceover: (id: number) => get().voiceover[id],
setPreferredVoiceover: (id: number, voiceover: string) => { setPreferredVoiceover: (id: number, voiceover: string) => {
let current = get().voiceover let current = get().voiceover