Récupération de défis et tirage d'un nouveau défi via des boutons

This commit is contained in:
2024-12-12 22:55:59 +01:00
parent 9d0b5cb254
commit 04f30e3ac2
12 changed files with 193 additions and 34 deletions

View File

@ -1,5 +1,5 @@
import { useAppDispatch, useAppSelector } from "./useStore"
import { GamePayload, setPlayerId, updateGameState, updateMoney } from "@/utils/features/game/gameSlice"
import { GamePayload, setPlayerId, updateActiveChallengeId, updateGameState, updateMoney } from "@/utils/features/game/gameSlice"
export const useGame = () => useAppSelector((state) => state.game)
export const useSetPlayerId = () => {
@ -10,6 +10,10 @@ export const useUpdateMoney = () => {
const dispatch = useAppDispatch()
return (money: number) => dispatch(updateMoney(money))
}
export const useUpdateActiveChallengeId = () => {
const dispatch = useAppDispatch()
return (challengeActionId: number) => dispatch(updateActiveChallengeId(challengeActionId))
}
export const useUpdateGameState = () => {
const dispatch = useAppDispatch()
return (game: GamePayload) => dispatch(updateGameState(game))