File tree Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -183,17 +183,13 @@ export default defineComponent({
183183 useFetch (async () => {
184184 await categoriesListLoad ({ pageSize: 20 });
185185
186- function prepareMenuData() {
187- return categoryList .value ?.[0 ]?.children
188- .map ((category ) => ({
189- includeInMenu: category .include_in_menu ,
190- label: category .name ,
191- slug: ` /${category .url_path }${category .url_suffix } ` ,
192- }))
193- .filter ((category ) => category .includeInMenu ) ?? [];
194- }
195-
196- categoryTree .value = prepareMenuData ();
186+ categoryTree .value = categoryList .value ?.[0 ]?.children
187+ .filter ((category ) => category .include_in_menu )
188+ .map ((category ) => ({
189+ includeInMenu: category .include_in_menu ,
190+ label: category .name ,
191+ slug: ` /${category .url_path }${category .url_suffix } ` ,
192+ })) ?? [];
197193 });
198194
199195 onMounted (() => {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export const productData = (products) => {
88 id,
99 product : computed ( ( ) => {
1010 if ( ! products ) return { } ;
11- return Array . isArray ( products . value ?. items ) && products . value ?. items [ 0 ] ? products . value ?. items [ 0 ] : [ ] ;
11+ return products . value ?. items ?. [ 0 ] ?? [ ] ;
1212 } ) ,
1313 } ;
1414} ;
Original file line number Diff line number Diff line change @@ -106,7 +106,6 @@ import {
106106} from ' @nuxtjs/composition-api' ;
107107import LazyHydrate from ' vue-lazy-hydration' ;
108108import { useCache , CacheTagPrefix } from ' @vue-storefront/cache' ;
109- import { productGetters } from ' ~/getters' ;
110109import { useProduct } from ' ~/composables' ;
111110import MobileStoreBanner from ' ~/components/MobileStoreBanner.vue' ;
112111import InstagramFeed from ' ~/components/InstagramFeed.vue' ;
@@ -241,7 +240,7 @@ export default defineComponent({
241240 ]);
242241
243242 onMounted (async () => {
244- const productsData = await getProductList ({
243+ newProducts . value = await getProductList ({
245244 pageSize: 10 ,
246245 currentPage: 1 ,
247246 sort: {
@@ -250,8 +249,6 @@ export default defineComponent({
250249 });
251250
252251 addTags ([{ prefix: CacheTagPrefix .View , value: ' home' }]);
253-
254- newProducts .value = productsData? .items ;
255252 });
256253
257254 // @ts-ignore
@@ -260,7 +257,6 @@ export default defineComponent({
260257 heroes,
261258 newProducts,
262259 newProductsLoading,
263- productGetters,
264260 };
265261 },
266262});
You can’t perform that action at this time.
0 commit comments