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

View File

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