Files
heygermany-e2e-mrg5ct1q/apps/website/hooks/backoffice/useUpdateDocumentVerification.ts
e2e 2c4174b44b
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 11:13:08 +02:00

28 lines
829 B
TypeScript

import { pikku } from "@/pikku/http"
import type { DB } from '@heygermany/sdk'
import { useMutation, useQueryClient } from "@tanstack/react-query"
type UpdateDocumentVerificationInput = {
documentId: string
documentStatus: DB.DocumentStatus
}
export const useUpdateDocumentVerification = (candidateId: string) => {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async ({ documentId, documentStatus }: UpdateDocumentVerificationInput) =>
await pikku().patch("/backoffice/candidate/:candidateId/document/:documentId", {
candidateId,
documentId,
documentStatus
}),
onSuccess: () => {
// Invalidate and refetch the candidate data
queryClient.invalidateQueries({
queryKey: ['backoffice', 'candidate', candidateId]
})
}
})
}