fixed moving multiple folders list
This commit is contained in:
@@ -41,15 +41,20 @@ export const getMoveFolderListAPI = async ({
|
||||
}: QueryFunctionContext<
|
||||
[
|
||||
string,
|
||||
{ parent: string; search: string; folderID?: string; currentParent: string }
|
||||
{
|
||||
parent: string;
|
||||
search: string;
|
||||
folderIDs?: string[];
|
||||
currentParent: string;
|
||||
}
|
||||
]
|
||||
>) => {
|
||||
const [_key, { parent, search, folderID, currentParent }] = queryKey;
|
||||
const [_key, { parent, search, folderIDs, currentParent }] = queryKey;
|
||||
const response = await axios.get(`/folder-service/move-folder-list`, {
|
||||
params: {
|
||||
parent,
|
||||
search,
|
||||
folderID,
|
||||
folderIDs,
|
||||
currentParent,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -37,10 +37,18 @@ const MoverPopup = () => {
|
||||
folderID: "",
|
||||
});
|
||||
|
||||
const foldersToMove = useAppSelector((state) => {
|
||||
if (state.selected.multiSelectMode) {
|
||||
return Object.keys(state.selected.multiSelectMap);
|
||||
} else {
|
||||
return [state.selected.mainSection.id];
|
||||
}
|
||||
});
|
||||
|
||||
const { data: folderList, isLoading: isLoadingFolders } = useMoveFolders(
|
||||
parent?._id || "/",
|
||||
debouncedSearch,
|
||||
folder?._id
|
||||
foldersToMove
|
||||
);
|
||||
|
||||
const debouncedSetSearchText = useMemo(
|
||||
|
||||
@@ -75,7 +75,7 @@ export const useFolder = () => {
|
||||
export const useMoveFolders = (
|
||||
parent: string,
|
||||
search: string,
|
||||
folderID?: string
|
||||
folderIDs?: string[]
|
||||
) => {
|
||||
const params = useParams();
|
||||
const moveFoldersQuery = useQuery(
|
||||
@@ -84,7 +84,7 @@ export const useMoveFolders = (
|
||||
{
|
||||
parent,
|
||||
search,
|
||||
folderID,
|
||||
folderIDs,
|
||||
currentParent: params.id || "/",
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user