feat: add normalized public search filters
Quality / test (push) Canceled after 0s

Add strict public search numeric validation and URL-backed category and price filters to the catalog UI.
This commit is contained in:
2026-09-09 01:32:32 -04:00
parent 7aa8e9eaf2
commit 67ce29a93e
5 changed files with 49 additions and 13 deletions
+4 -1
View File
@@ -1,7 +1,10 @@
const apiBaseUrl = import.meta.env?.VITE_API_BASE_URL ?? '/api/v1';
export async function searchCatalog({ query = '', page = 1, limit = 20 } = {}) {
export async function searchCatalog({ query = '', category = '', minPriceMinor, maxPriceMinor, page = 1, limit = 20 } = {}) {
const params = new URLSearchParams({ query, page: String(page), limit: String(limit) });
if (category) params.set('category', category);
if (typeof minPriceMinor === 'number') params.set('minPriceMinor', String(minPriceMinor));
if (typeof maxPriceMinor === 'number') params.set('maxPriceMinor', String(maxPriceMinor));
const response = await fetch(`${apiBaseUrl}/public/search?${params}`);
if (!response.ok) {