Files
heygermany-e2e-mrg46en3/apps/website/hooks/candidate/useGetCandidate.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

19 lines
562 B
TypeScript

import { pikku } from '@/pikku/http'
import type { ApplicationCandidateData } from '@heygermany/sdk'
import { useQuery } from '@tanstack/react-query'
export const useGetCandidate = (candidateId?: string) => {
return useQuery({
queryKey: ['candidate'],
queryFn: async (): Promise<ApplicationCandidateData> => {
if (!candidateId) {
return await pikku().get('/candidate')
} else {
return await pikku().get('/candidate/:candidateId', { candidateId })
}
},
staleTime: 5 * 60 * 1000, // 5 minutes,
retry: 0
})
}