feat: product options, speedup home page, themes

This commit is contained in:
Nikita Kiselev
2025-07-21 13:37:09 +03:00
parent 51ce6ed959
commit e3cc0d4b10
18 changed files with 181 additions and 79 deletions

View File

@@ -0,0 +1,25 @@
import {defineStore} from "pinia";
import ftch from "../utils/ftch.js";
export const useCategoriesStore = defineStore('categories', {
state: () => ({
topCategories: [],
isLoading: false,
}),
actions: {
async fetchTopCategories() {
try {
this.isLoading = true;
const response = await ftch('categoriesList', {
perPage: 7,
});
this.topCategories = response.data;
} catch (error) {
console.error(error);
} finally {
this.isLoading = false;
}
},
},
});

View File

@@ -0,0 +1,25 @@
import {defineStore} from "pinia";
import ftch from "../utils/ftch.js";
export const useProductsStore = defineStore('products', {
state: () => ({
homeProducts: {
data: [],
meta: {},
},
isLoading: false,
}),
actions: {
async fetchHomeProducts() {
try {
this.isLoading = true;
this.homeProducts = await ftch('products');
} catch (error) {
console.error(error);
} finally {
this.isLoading = false;
}
},
},
});