added multiselect logic, implemented trash and multi trash

This commit is contained in:
subnub
2024-06-27 23:31:45 -04:00
parent 99201318b5
commit 9f0821253d
28 changed files with 707 additions and 63 deletions
+18 -1
View File
@@ -10,6 +10,7 @@ interface QueryKeyParams {
startAtDate?: string;
startAtName?: string;
startAt?: boolean;
trashMode?: boolean;
}
// GET
@@ -20,7 +21,7 @@ export const getFilesListAPI = async ({
}: QueryFunctionContext<[string, QueryKeyParams]>) => {
const [
_key,
{ parent = "/", search = "", sortBy = "date_desc", limit = 50 },
{ parent = "/", search = "", sortBy = "date_desc", limit = 50, trashMode },
] = queryKey;
const queryParams: QueryKeyParams = {
@@ -28,6 +29,7 @@ export const getFilesListAPI = async ({
search,
sortBy,
limit,
trashMode,
};
if (pageParam?.startAtDate && pageParam?.startAtName) {
@@ -93,6 +95,21 @@ export const getSuggestedListAPI = async ({
};
// PATCH
export const trashFileAPI = async (fileID: string) => {
const response = await axios.patch(`/file-service/trash`, {
id: fileID,
});
return response.data;
};
export const trashMultiAPI = async (items: any) => {
const response = await axios.patch(`/file-service/trash-multi`, {
items,
});
return response.data;
};
export const renameFileAPI = async (fileID: string, name: string) => {
const response = await axios.patch(`/file-service/rename`, {
id: fileID,