feat: cache frontpage products and categories

This commit is contained in:
2025-08-08 15:02:21 +03:00
parent 2fb841ef08
commit 5f785e82e6
7 changed files with 598 additions and 44 deletions

View File

@@ -17,13 +17,14 @@ export const useProductsStore = defineStore('products', {
}),
actions: {
async fetchProducts(categoryId = null, page = 1) {
async fetchProducts(categoryId = null, page = 1, forMainPage = false) {
try {
this.isLoading = true;
return await ftch('products', {
categoryId: categoryId,
page: page,
search: this.search,
forMainPage: forMainPage,
});
} catch (error) {
console.error(error);