discount
This commit is contained in:
@@ -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
|
||||
),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user