WIP
This commit is contained in:
@@ -18,7 +18,16 @@ export const useDocuments = (params: UseDocumentsParams = {}) => {
|
||||
})
|
||||
|
||||
const uploadMutation = useMutation({
|
||||
mutationFn: (file: File) => documentsApi.upload(file),
|
||||
mutationFn: ({ file, groupKey }: { file: File; groupKey?: string }) =>
|
||||
documentsApi.upload(file, groupKey),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['documents'] })
|
||||
},
|
||||
})
|
||||
|
||||
const updateGroupKeyMutation = useMutation({
|
||||
mutationFn: ({ documentId, groupKey }: { documentId: string; groupKey: string | null }) =>
|
||||
documentsApi.updateGroupKey(documentId, groupKey),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['documents'] })
|
||||
},
|
||||
@@ -74,5 +83,8 @@ export const useDocuments = (params: UseDocumentsParams = {}) => {
|
||||
isUpdatingStatus: updateStatusMutation.isPending,
|
||||
triggerAutoLabel: triggerAutoLabelMutation.mutate,
|
||||
isTriggeringAutoLabel: triggerAutoLabelMutation.isPending,
|
||||
updateGroupKey: updateGroupKeyMutation.mutate,
|
||||
updateGroupKeyAsync: updateGroupKeyMutation.mutateAsync,
|
||||
isUpdatingGroupKey: updateGroupKeyMutation.isPending,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user