Files
Mav-Mobile-UI/src/context/reducers/SoundContextReducer.ts

24 lines
588 B
TypeScript

import type { SoundPayload, SoundState } from "../../types/types";
export const initalState: SoundState = {
sightingSound: "switch",
NPEDsound: "popup",
hotlists: [],
};
export function reducer(state: SoundState, action: SoundPayload) {
switch (action.type) {
case "UPDATE":
return {
...state,
sightingSound: action.payload.sightingSound,
NPEDsound: action.payload.NPEDsound,
hotlists: action.payload.hotlists.map((hotlist) => ({
name: hotlist.name,
sound: hotlist.sound,
})),
};
}
return state;
}