17 lines
490 B
TypeScript
17 lines
490 B
TypeScript
import { fetchTime } from "../../services/game/game";
|
|
import { GameAction } from "./actions";
|
|
import { IGameState } from "./types";
|
|
|
|
function gameReducer(state: IGameState, action: GameAction): IGameState {
|
|
switch (action.type) {
|
|
case "FETCH_TIME_START":
|
|
fetchTime();
|
|
return { ...state };
|
|
case "FETCH_TIME_FINISH":
|
|
return { ...state, time: action.payload };
|
|
default:
|
|
return state;
|
|
}
|
|
}
|
|
|
|
export { gameReducer };
|