made query into hook, converted more files to typescript

This commit is contained in:
subnub
2024-06-19 18:44:42 -04:00
parent 49e6bab79c
commit 55142b29f9
13 changed files with 127 additions and 127 deletions
+24
View File
@@ -0,0 +1,24 @@
import { QueryFunctionContext } from "react-query";
import axios from "../axiosInterceptor";
interface QueryKeyParams {
parent: string;
search?: string;
sortBy?: string;
limit?: number;
}
export const getFoldersList = async ({
queryKey,
}: QueryFunctionContext<[string, QueryKeyParams]>) => {
const [_key, { parent, search, sortBy, limit }] = queryKey;
const response = await axios.get(`/folder-service/list`, {
params: {
parent,
search,
sortBy,
limit,
},
});
return response.data;
};