summaryrefslogtreecommitdiff
path: root/src-migrate/modules/product-detail/components/ProductDetail.tsx
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2024-07-02 10:40:06 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2024-07-02 10:40:06 +0700
commit556cbc1e5ea1c1ef0170c9a1b8f470a3d92d888e (patch)
tree61677a0ba6b76412ec3af0d0a2e91babe0d8cf5d /src-migrate/modules/product-detail/components/ProductDetail.tsx
parentd1f70e37fdea0d677cedccec9effdbeeb91656aa (diff)
IS SO APPROVAL
Diffstat (limited to 'src-migrate/modules/product-detail/components/ProductDetail.tsx')
-rw-r--r--src-migrate/modules/product-detail/components/ProductDetail.tsx12
1 files changed, 10 insertions, 2 deletions
diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx
index 3b1bdbea..6cd72353 100644
--- a/src-migrate/modules/product-detail/components/ProductDetail.tsx
+++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx
@@ -22,6 +22,7 @@ import PriceAction from './PriceAction'
import SimilarBottom from './SimilarBottom'
import SimilarSide from './SimilarSide'
import VariantList from './VariantList'
+import { getAuth } from '~/libs/auth'
type Props = {
product: IProductDetail
@@ -32,7 +33,8 @@ const SELF_HOST = process.env.NEXT_PUBLIC_SELF_HOST
const ProductDetail = ({ product }: Props) => {
const { isDesktop, isMobile } = useDevice()
const router = useRouter()
- const { setAskAdminUrl, askAdminUrl, activeVariantId } = useProductDetail()
+ const auth = getAuth()
+ const { setAskAdminUrl, askAdminUrl, activeVariantId, setIsApproval, isApproval } = useProductDetail()
useEffect(() => {
const createdAskUrl = whatsappUrl({
@@ -48,6 +50,12 @@ const ProductDetail = ({ product }: Props) => {
setAskAdminUrl(createdAskUrl)
}, [router.asPath, product.manufacture.name, product.name, setAskAdminUrl])
+ useEffect(() => {
+ if (typeof auth === 'object') {
+ setIsApproval(auth?.feature?.soApproval);
+ }
+ }, []);
+
return (
<>
<div className='md:flex md:flex-wrap'>
@@ -115,7 +123,7 @@ const ProductDetail = ({ product }: Props) => {
)}
<div className='h-4 md:h-10' />
- {!!activeVariantId && <ProductPromoSection productId={activeVariantId} />}
+ {!!activeVariantId && !isApproval && <ProductPromoSection productId={activeVariantId} />}
<div className={style['section-card']}>
<h2 className={style['heading']}>