added sorting2

This commit is contained in:
@jcarymuhammedow
2026-04-18 12:10:38 +05:00
parent a2298dfa9c
commit 76c819848b
4 changed files with 99 additions and 41 deletions

View File

@@ -32,12 +32,24 @@ export const brandsApi = baseApi.injectEndpoints({
return `/brands/${params}/products`;
}
const { id, page = 1, limit } = params;
const { id, page = 1, limit, sorting, min_price, max_price, brands } = params;
let url = `/brands/${id}/products?page=${page}`;
if (limit) {
url += `&limit=${limit}`;
}
if (sorting) {
url += `&sorting=${encodeURIComponent(sorting)}`;
}
if (min_price) {
url += `&min_price=${encodeURIComponent(min_price)}`;
}
if (max_price) {
url += `&max_price=${encodeURIComponent(max_price)}`;
}
if (brands) {
url += `&brands=${encodeURIComponent(brands)}`;
}
return url;
},