feat: Delete the files uploaded in the external dialog box #1880 (#1967)

### What problem does this PR solve?

feat: Delete the files uploaded in the external dialog box #1880

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-08-15 18:31:46 +08:00
committed by GitHub
parent d3ff1a30bf
commit 7bdd5a48c0
11 changed files with 111 additions and 33 deletions

View File

@ -313,3 +313,23 @@ export const useRemoveNextDocument = () => {
return { data, loading, removeDocument: mutateAsync };
};
export const useDeleteDocument = () => {
// const queryClient = useQueryClient();
const {
data,
isPending: loading,
mutateAsync,
} = useMutation({
mutationKey: ['deleteDocument'],
mutationFn: async (documentIds: string[]) => {
const data = await kbService.document_delete({ doc_ids: documentIds });
// if (data.retcode === 0) {
// queryClient.invalidateQueries({ queryKey: ['fetchFlowList'] });
// }
return data;
},
});
return { data, loading, deleteDocument: mutateAsync };
};