chore: heygermany customer project
This commit is contained in:
21
apps/website/hooks/useGetCandidateResult.ts
Normal file
21
apps/website/hooks/useGetCandidateResult.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
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
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user