traintrape-moi/client/hooks/useChallenges.ts

9 lines
414 B
TypeScript

import { ChallengesPayload, downloadChallenges } from "@/utils/features/challenges/challengesSlice"
import { useAppDispatch, useAppSelector } from "./useStore"
export const useChallenges = () => useAppSelector((state) => state.challenges)
export const useDownloadChallenges = () => {
const dispath = useAppDispatch()
return (challengesData: ChallengesPayload) => dispath(downloadChallenges(challengesData))
}