Structure de données jeu client
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { AuthState } from "@/utils/features/location/authSlice"
|
||||
import { AuthState } from "@/utils/features/auth/authSlice"
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
import { LocationObject } from "expo-location"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { AuthPayload } from "@/utils/features/location/authSlice"
|
||||
import { AuthPayload } from "@/utils/features/auth/authSlice"
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
|
||||
type ErrorResponse = {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useAppDispatch, useAppSelector } from "./useStore"
|
||||
import { AuthPayload, login, logout } from "@/utils/features/location/authSlice"
|
||||
import { AuthPayload, login, logout } from "@/utils/features/auth/authSlice"
|
||||
|
||||
export const useAuth = () => useAppSelector((state) => state.auth)
|
||||
export const useAuthLogin = () => {
|
||||
|
3
client/hooks/useChallengeActions.ts
Normal file
3
client/hooks/useChallengeActions.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { useAppSelector } from "./useStore"
|
||||
|
||||
export const useChallengeActions = () => useAppSelector((state) => state.challengeActions)
|
3
client/hooks/useChallenges.ts
Normal file
3
client/hooks/useChallenges.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { useAppSelector } from "./useStore"
|
||||
|
||||
export const useTrain = () => useAppSelector((state) => state.challenges)
|
12
client/hooks/useGame.ts
Normal file
12
client/hooks/useGame.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { useAppDispatch, useAppSelector } from "./useStore"
|
||||
import { setPlayerId, updateMoney } from "@/utils/features/game/gameSlice"
|
||||
|
||||
export const useGame = () => useAppSelector((state) => state.game)
|
||||
export const useSetPlayerId = () => {
|
||||
const dispath = useAppDispatch()
|
||||
return (playerId: number) => dispath(setPlayerId(playerId))
|
||||
}
|
||||
export const useUpdateMoney = () => {
|
||||
const dispatch = useAppDispatch()
|
||||
return (money: number) => dispatch(updateMoney(money))
|
||||
}
|
3
client/hooks/useTrain.ts
Normal file
3
client/hooks/useTrain.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { useAppSelector } from "./useStore"
|
||||
|
||||
export const useTrain = () => useAppSelector((state) => state.train)
|
Reference in New Issue
Block a user