From bca256dfc413400a6c17ca189a8f31a15d82473a Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Sat, 2 Sep 2023 10:36:41 +0700
Subject: button wa jika sudah login redirect ke halaman sebelumnya

---
 src/core/components/layouts/BasicLayout.jsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/core/components/layouts/BasicLayout.jsx')

diff --git a/src/core/components/layouts/BasicLayout.jsx b/src/core/components/layouts/BasicLayout.jsx
index 2e98eb61..f84cce40 100644
--- a/src/core/components/layouts/BasicLayout.jsx
+++ b/src/core/components/layouts/BasicLayout.jsx
@@ -17,6 +17,7 @@ const AnimationLayout = dynamic(() => import('./AnimationLayout'))
 const BasicLayout = ({ children }) => {
   const [templateWA, setTemplateWA] = useState(null)
   const [payloadWA, setPayloadWa] = useState(null)
+  const [urlPath, setUrlPath] = useState(null)
 
   const router = useRouter()
 
@@ -45,6 +46,8 @@ const BasicLayout = ({ children }) => {
       }
       getProduct()
       setTemplateWA('product')
+
+      setUrlPath(router.asPath)
     }
   }, [])
   return (
@@ -54,7 +57,7 @@ const BasicLayout = ({ children }) => {
         {children}
         <div className='fixed bottom-4 right-4 sm:bottom-14 sm:right-10 z-50'>
           <a
-            href={whatsappUrl(templateWA, payloadWA)}
+            href={whatsappUrl(templateWA, payloadWA, urlPath)}
             className='py-2 pl-3 pr-4 rounded-full bg-[#4FB84A] border border-green-300 flex items-center'
             rel='noopener noreferrer'
             target='_blank'
-- 
cgit v1.2.3

