This commit is contained in:
hamid zarghami
2025-02-17 11:57:03 +03:30
parent df8c000aa6
commit 71a11ff2e7
11 changed files with 348 additions and 114 deletions
+19 -3
View File
@@ -13,12 +13,28 @@ export const useGetAllServices = (
page: number,
category: string,
status: string,
isDanakSuggest: boolean
isDanakSuggest?: boolean,
limit?: number
) => {
return useQuery({
queryKey: ["services", search, page, category, status, isDanakSuggest],
queryKey: [
"services",
search,
page,
category,
status,
isDanakSuggest,
limit,
],
queryFn: () =>
api.getAllServicess(search, page, category, status, isDanakSuggest),
api.getAllServicess(
search,
page,
category,
status,
isDanakSuggest,
limit
),
});
};
+8 -2
View File
@@ -12,7 +12,8 @@ export const getAllServicess = async (
page: number,
category: string,
status: string,
isDanakSuggest: boolean
isDanakSuggest?: boolean,
limit?: number
) => {
let query = `?page=${page}`;
if (status) {
@@ -25,9 +26,14 @@ export const getAllServicess = async (
query += `&q=${search}`;
}
if (isDanakSuggest) {
if (isDanakSuggest !== undefined) {
query += `&isDanakSuggest=${isDanakSuggest}`;
}
if (limit) {
query += `&limit=${limit}`;
}
const { data } = await axios.get(`/danak-services${query}`);
return data;
};