fix: search

This commit is contained in:
2025-12-09 00:30:00 +03:00
parent ecd372dad3
commit e5792a059a
2 changed files with 7 additions and 6 deletions

View File

@@ -32,7 +32,7 @@ export const useSearchStore = defineStore('search', {
},
async fetchProducts(search, page = 1, perPage = 5) {
return await ftch('products', {
return await ftch('products', null, {
page,
perPage: perPage,
search,
@@ -68,13 +68,14 @@ export const useSearchStore = defineStore('search', {
this.isLoadingMore = true;
this.page++;
console.debug('[Search] Loading more products for page: ', this.page);
const response = await ftch('products', null, toRaw({
const data = toRaw({
page: this.page,
perPage: 10,
search: this.search,
}));
});
console.debug('[Search] Loading more products: ', data);
const response = await ftch('products', null, data);
console.debug('[Search] Search results: ', response);

View File

@@ -32,7 +32,7 @@ class ProductsHandler
$page = (int) $request->json('page', 1);
$perPage = min((int) $request->json('perPage', 20), 20);
$maxPages = (int) $request->json('maxPages', 10);
$search = trim($request->get('search', ''));
$search = trim($request->json('search', ''));
$filters = $request->json('filters');
$languageId = $this->settings->config()->getApp()->getLanguageId();