mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-03 11:05:30 +08:00
### What problem does this PR solve? Feat: Deleting files in batches. #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
19
web/src/pages/files/use-delete-file.ts
Normal file
19
web/src/pages/files/use-delete-file.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { useDeleteFile } from '@/hooks/use-file-request';
|
||||
import { useCallback } from 'react';
|
||||
import { useGetFolderId } from './hooks';
|
||||
|
||||
export const useHandleDeleteFile = () => {
|
||||
const { deleteFile: removeDocument } = useDeleteFile();
|
||||
const parentId = useGetFolderId();
|
||||
|
||||
const handleRemoveFile = useCallback(
|
||||
async (fileIds: string[]) => {
|
||||
const code = await removeDocument({ fileIds, parentId });
|
||||
|
||||
return code;
|
||||
},
|
||||
[parentId, removeDocument],
|
||||
);
|
||||
|
||||
return { handleRemoveFile };
|
||||
};
|
||||
Reference in New Issue
Block a user