@@ -97,17 +97,17 @@ import {
9797 SfCallToAction ,
9898 SfBannerGrid ,
9999} from ' @storefront-ui/vue' ;
100- import { productGetters } from ' ~/getters' ;
101100
102101import {
103102 computed ,
104103 defineComponent ,
105104 ref ,
106105 useContext ,
107- useFetch ,
106+ useAsync ,
108107} from ' @nuxtjs/composition-api' ;
109108import LazyHydrate from ' vue-lazy-hydration' ;
110109import { useCache , CacheTagPrefix } from ' @vue-storefront/cache' ;
110+ import { productGetters } from ' ~/getters' ;
111111import { useProduct } from ' ~/composables' ;
112112import MobileStoreBanner from ' ~/components/MobileStoreBanner.vue' ;
113113import InstagramFeed from ' ~/components/InstagramFeed.vue' ;
@@ -133,10 +133,7 @@ export default defineComponent({
133133 const { addTags } = useCache ();
134134 const { app } = useContext ();
135135 const year = new Date ().getFullYear ();
136- const products = ref ({});
137-
138136 const { getProductList , loading: newProductsLoading } = useProduct ();
139-
140137 const heroes = ref ([
141138 {
142139 title: app .i18n .t (' Colorful summer dresses are already in store' ),
@@ -243,20 +240,22 @@ export default defineComponent({
243240 },
244241 ]);
245242
246- // @ts-ignore
247- const newProducts = computed (() => productGetters .getFiltered (products .value ? .items , { master: true }));
248-
249- useFetch (async () => {
250- products .value = await getProductList ({
243+ const products = useAsync (async () => {
244+ const productsData = await getProductList ({
251245 pageSize: 10 ,
252246 currentPage: 1 ,
253247 sort: {
254248 position: ' ASC' ,
255249 },
256250 });
251+
257252 addTags ([{ prefix: CacheTagPrefix .View , value: ' home' }]);
253+ return productsData;
258254 });
259255
256+ // @ts-ignore
257+ const newProducts = computed (() => productGetters .getFiltered (products .value ? .items , { master: true }));
258+
260259 return {
261260 banners,
262261 heroes,
0 commit comments