chore: heygermany customer project
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { pikku } from "@/pikku/http"
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query"
|
||||
import { UpdateBackOfficeCandidateInput } from '@heygermany/functions/.pikku/http/pikku-http-wirings-map.gen.d.js'
|
||||
|
||||
type BackOfficeCandidatePatch = Omit<UpdateBackOfficeCandidateInput, 'candidateId'> & {
|
||||
analysisIssues?: string[]
|
||||
}
|
||||
|
||||
export const useUpdateBackOfficeCandidate = (candidateId: string) => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (data: BackOfficeCandidatePatch) =>
|
||||
await pikku().patch("/backoffice/candidate/:candidateId", { candidateId, ...data }),
|
||||
onSuccess: () => {
|
||||
// Invalidate and refetch the candidate data
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ['backoffice', 'candidate', candidateId]
|
||||
})
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ['candidate', candidateId]
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user