mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: create folder feat: ensure that all files in the current folder can be correctly requested after renaming the folder #345 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -22,10 +22,10 @@ export const useRemoveFile = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const removeFile = useCallback(
|
||||
(fileIds: string[]) => {
|
||||
(fileIds: string[], parentId: string) => {
|
||||
return dispatch<any>({
|
||||
type: 'fileManager/removeFile',
|
||||
payload: { fileIds },
|
||||
payload: { fileIds, parentId },
|
||||
});
|
||||
},
|
||||
[dispatch],
|
||||
@ -38,10 +38,10 @@ export const useRenameFile = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const renameFile = useCallback(
|
||||
(fileId: string, name: string) => {
|
||||
(fileId: string, name: string, parentId: string) => {
|
||||
return dispatch<any>({
|
||||
type: 'fileManager/renameFile',
|
||||
payload: { fileId, name },
|
||||
payload: { fileId, name, parentId },
|
||||
});
|
||||
},
|
||||
[dispatch],
|
||||
@ -66,6 +66,22 @@ export const useFetchParentFolderList = () => {
|
||||
return fetchParentFolderList;
|
||||
};
|
||||
|
||||
export const useCreateFolder = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const createFolder = useCallback(
|
||||
(parentId: string, name: string) => {
|
||||
return dispatch<any>({
|
||||
type: 'fileManager/createFolder',
|
||||
payload: { parentId, name, type: 'folder' },
|
||||
});
|
||||
},
|
||||
[dispatch],
|
||||
);
|
||||
|
||||
return createFolder;
|
||||
};
|
||||
|
||||
export const useSelectFileList = () => {
|
||||
const fileList = useSelector((state) => state.fileManager.fileList);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user