Files
heygermany-e2e-mrg46en3/apps/website/hooks/useGetCandidateResult.ts
e2e 6e43ee3df9
Some checks failed
Main / Setup and Test (push) Has been cancelled
Main / Build Website (push) Has been cancelled
chore: heygermany customer project
2026-07-11 10:40:10 +02:00

21 lines
778 B
TypeScript

import { pikku } from "@/pikku/http"
import { useQuery } from "@tanstack/react-query"
import { CandidateResults } from "@heygermany/sdk"
import { useI18n } from "@/context/i18n-provider"
export const useGetCandidateResults = (candidateId?: string) => {
const { locale } = useI18n()
return useQuery({
queryKey: ['candidate', candidateId, 'results', locale],
queryFn: async (): Promise<CandidateResults> => {
try {
const result = await pikku().get(`/candidate/:candidateId/results`, { candidateId: candidateId!, locale })
return result
} catch (error) {
throw error
}
},
enabled: !!candidateId,
retry: false // Disable retry for debugging
})
}