feat: add public catalog web foundation
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:3000/api/v1';
|
||||
|
||||
export async function searchCatalog({ query = '', page = 1, limit = 20 } = {}) {
|
||||
const params = new URLSearchParams({ query, page: String(page), limit: String(limit) });
|
||||
const response = await fetch(`${apiBaseUrl}/public/search?${params}`);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Catalog search is unavailable.');
|
||||
}
|
||||
|
||||
const payload = await response.json();
|
||||
return payload.data;
|
||||
}
|
||||
Reference in New Issue
Block a user