mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? fix: remove unused libraries #1306 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -4,11 +4,12 @@ import {
|
||||
IFileListRequestBody,
|
||||
} from '@/interfaces/request/file-manager';
|
||||
import fileManagerService from '@/services/file-manager-service';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { PaginationProps, UploadFile } from 'antd';
|
||||
import React, { useCallback } from 'react';
|
||||
import { useDispatch, useSearchParams, useSelector } from 'umi';
|
||||
import { useGetNextPagination, useHandleSearchChange } from './logic-hooks';
|
||||
import { useSetPaginationParams } from './route-hook';
|
||||
|
||||
export const useGetFolderId = () => {
|
||||
const [searchParams] = useSearchParams();
|
||||
@ -48,13 +49,19 @@ export const useFetchNextFileList = (): ResponseType<any> & IListResult => {
|
||||
const { data } = useQuery({
|
||||
queryKey: [
|
||||
'fetchFileList',
|
||||
id,
|
||||
pagination.current,
|
||||
pagination.pageSize,
|
||||
searchString,
|
||||
// pagination.current,
|
||||
// id,
|
||||
// pagination.pageSize,
|
||||
// searchString,
|
||||
{
|
||||
id,
|
||||
searchString,
|
||||
...pagination,
|
||||
},
|
||||
],
|
||||
initialData: {},
|
||||
queryFn: async () => {
|
||||
queryFn: async (params: any) => {
|
||||
console.info(params);
|
||||
const { data } = await fileManagerService.listFile({
|
||||
parent_id: id,
|
||||
keywords: searchString,
|
||||
@ -99,6 +106,26 @@ export const useRemoveFile = () => {
|
||||
return removeFile;
|
||||
};
|
||||
|
||||
export const useDeleteFile = () => {
|
||||
const { setPaginationParams } = useSetPaginationParams();
|
||||
const {
|
||||
data,
|
||||
isPending: loading,
|
||||
mutateAsync,
|
||||
} = useMutation({
|
||||
mutationKey: ['deleteFile'],
|
||||
mutationFn: async (params: { fileIds: string[]; parentId: string }) => {
|
||||
const { data } = await fileManagerService.removeFile(params);
|
||||
if (data.retcode === 0) {
|
||||
setPaginationParams(1);
|
||||
}
|
||||
return data?.data ?? {};
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading, deleteFile: mutateAsync };
|
||||
};
|
||||
|
||||
export const useRenameFile = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user