Files
heygermany-e2e-mrg1d1zl/apps/website/hooks/backoffice/useUpdateCandidateEducation.ts
e2e 59b4a7a404
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 09:21:21 +02:00

23 lines
803 B
TypeScript

import { pikku } from "@/pikku/http"
import type { DB } from '@heygermany/sdk'
import { useMutation, useQueryClient } from "@tanstack/react-query"
type EducationUpdatePayload = Partial<Omit<DB.CandidateEducation, 'candidateId' | 'educationId' | 'createdAt' | 'lastUpdatedAt'>>
export const useUpdateCandidateEducation = (candidateId: string) => {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (data: EducationUpdatePayload) =>
await pikku().patch("/backoffice/candidate/:candidateId/education", { candidateId, ...data }),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: ['backoffice', 'candidate', candidateId]
})
queryClient.invalidateQueries({
queryKey: ['candidate', candidateId]
})
}
})
}