chore: heygermany customer project
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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]
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user