From e4b035a1471bd70872bb12012442367933fc8852 Mon Sep 17 00:00:00 2001 From: IT Fixcomart Date: Thu, 3 Nov 2022 17:30:14 +0700 Subject: Show banner and brand in home --- src/pages/shop/product/[slug].js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/pages/shop') diff --git a/src/pages/shop/product/[slug].js b/src/pages/shop/product/[slug].js index efc0be01..f50d5037 100644 --- a/src/pages/shop/product/[slug].js +++ b/src/pages/shop/product/[slug].js @@ -9,14 +9,16 @@ import currencyFormat from "../../../helpers/currencyFormat"; import Head from "next/head"; import { Swiper, SwiperSlide } from "swiper/react"; import { LazyLoadImage } from "react-lazy-load-image-component"; +import ImagePlaceholderIcon from "../../../icons/image-placeholder.svg"; import "swiper/css"; import "react-lazy-load-image-component/src/effects/blur.css"; -import ImagePlaceholderIcon from "../../../icons/image-placeholder.svg"; export async function getServerSideProps(context) { const { slug } = context.query; let product = await getOdoo('/api/v1/product/' + getId(slug)); - product = product[0]; + if (product.length == 1) { + product = product[0]; + } return {props: {product}}; } -- cgit v1.2.3