diff --git a/frontend/components/global/Header.vue b/frontend/components/global/Header.vue index 0e149ba..bd383d9 100644 --- a/frontend/components/global/Header.vue +++ b/frontend/components/global/Header.vue @@ -32,7 +32,12 @@ const megaMenuCategories = computed(() => { subitems: item.subcategorys.map((item) => { return { title: item.name, - link: item.slug, + subitems: item.subcategorys.map((item) => { + return { + title: item.name, + link: item.slug, + }; + }), }; }), }; diff --git a/frontend/components/global/MegaMenu.vue b/frontend/components/global/MegaMenu.vue index 0843000..32c99e7 100644 --- a/frontend/components/global/MegaMenu.vue +++ b/frontend/components/global/MegaMenu.vue @@ -7,7 +7,10 @@ type Props = { title: string; subitems: { title: string; - link: string; + subitems: { + title: string; + link: string; + }[]; }[]; }[]; }; @@ -157,14 +160,12 @@ onMounted(() => { />
-
+
diff --git a/frontend/components/global/ProductsGrid.vue b/frontend/components/global/ProductsGrid.vue index 6af65f3..30723e8 100644 --- a/frontend/components/global/ProductsGrid.vue +++ b/frontend/components/global/ProductsGrid.vue @@ -45,7 +45,7 @@ withDefaults(defineProps(), { :id="product.id" :slug="product.slug" :title="product.name" - :picture="product.variants[0].images[0].image" + :picture="product.image ?? product.variants[0].images[0].image" :colors="product.colors" :price="product.variants[0].price" :rate="product.rating" diff --git a/frontend/constants/index.ts b/frontend/constants/index.ts index a67d595..56f126e 100644 --- a/frontend/constants/index.ts +++ b/frontend/constants/index.ts @@ -37,7 +37,7 @@ export const API_ENDPOINTS = { }, products: { get_all: "/products", - categories: "/products/categories", + categories: "/products/categories/v2", saved: "/accounts/favorites", }, resellers_products: { diff --git a/frontend/types/global.d.ts b/frontend/types/global.d.ts index 0b400c9..bb10682 100644 --- a/frontend/types/global.d.ts +++ b/frontend/types/global.d.ts @@ -1,4 +1,4 @@ -export { }; +export {}; declare global { type ApiPaginated = { @@ -105,9 +105,13 @@ declare global { category: SubCategory; colors: string[]; added_to_favorites: boolean; + image: string | null; }; - type ProductListItem = Pick; + type ProductListItem = Pick< + Product, + "id" | "variants" | "name" | "rating" | "slug" | "category" | "colors" | "image" + >; type Article = { id: number; @@ -156,6 +160,7 @@ declare global { image: string; product_count: number; parent: string; + subcategorys: SubCategory[]; }; type Address = {