Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ import {
ref,
computed,
defineComponent,
PropType,
PropType, toRef,
} from '@nuxtjs/composition-api';

import {
Expand Down Expand Up @@ -170,8 +170,9 @@ export default defineComponent({
},
setup(props) {
const qty = ref(1);
const product = toRef(props, 'product');
const { addItem, canAddToCart } = useCart();
const { productGallery, imageSizes } = useProductGallery(props.product);
const { productGallery, imageSizes } = useProductGallery(product);
const { activeTab, setActiveTab, openNewReviewTab } = useProductTabs();
const { isAuthenticated } = useUser();
const { addItem: addItemToWishlist, isInWishlist } = useWishlist();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ import {
useRoute,
useRouter,
defineComponent,
PropType,
PropType, toRef,
} from '@nuxtjs/composition-api';

import {
Expand Down Expand Up @@ -227,10 +227,11 @@ export default defineComponent({
},
setup(props, { emit }) {
const qty = ref(1);
const product = toRef(props, 'product');
const route = useRoute();
const router = useRouter();
const { addItem, loading: isCartLoading, canAddToCart } = useCart();
const { productGallery, imageSizes } = useProductGallery(props.product);
const { productGallery, imageSizes } = useProductGallery(product);
const { activeTab, setActiveTab, openNewReviewTab } = useProductTabs();

const { isAuthenticated } = useUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ import {
ref,
computed,
defineComponent,
PropType,
PropType, toRef,
} from '@nuxtjs/composition-api';

import {
Expand Down Expand Up @@ -169,8 +169,9 @@ export default defineComponent({
},
setup(props) {
const qty = ref(1);
const product = toRef(props, 'product');
const { addItem, canAddToCart } = useCart();
const { productGallery, imageSizes } = useProductGallery(props.product);
const { productGallery, imageSizes } = useProductGallery(product);
const { activeTab, setActiveTab, openNewReviewTab } = useProductTabs();

const { isAuthenticated } = useUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ import {
computed,
defineComponent,
PropType,
toRef,
} from '@nuxtjs/composition-api';

import {
Expand Down Expand Up @@ -170,8 +171,9 @@ export default defineComponent({
},
setup(props) {
const qty = ref(1);
const product = toRef(props, 'product');
const { addItem, loading: isCartLoading, canAddToCart } = useCart();
const { productGallery, imageSizes } = useProductGallery(props.product);
const { productGallery, imageSizes } = useProductGallery(product);
const { isAuthenticated } = useUser();
const { addItem: addItemToWishlist, isInWishlist } = useWishlist();
const { activeTab, setActiveTab, openNewReviewTab } = useProductTabs();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { computed } from '@nuxtjs/composition-api';
import { computed, Ref } from '@nuxtjs/composition-api';
import { getGallery as getProductGallery } from '~/modules/catalog/product/getters/productGetters';
import { useImage } from '~/composables';
import type { Product } from '~/modules/catalog/product/types';
Expand All @@ -9,13 +9,13 @@ import type { UseProductGalleryInterface } from '~/modules/catalog/product/compo
*
* See the {@link UseProductGalleryInterface} page for more information.
*/
export function useProductGallery(product: Product): UseProductGalleryInterface {
export function useProductGallery(product: Ref<Product>): UseProductGalleryInterface {
const { getMagentoImage, imageSizes } = useImage();
const productGallery = computed(() => getProductGallery(product).map((img) => ({
const productGallery = computed(() => getProductGallery(product.value).map((img) => ({
mobile: { url: getMagentoImage(img.small) },
desktop: { url: getMagentoImage(img.normal) },
big: { url: getMagentoImage(img.big) },
alt: product.name,
alt: product.value.name,
})));

return {
Expand Down