mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 08:56:47 +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)
20 lines
515 B
TypeScript
20 lines
515 B
TypeScript
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 };
|
|
};
|