From dc3f5a3196a41c676f328aa0804af516d39e69f9 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 17 Sep 2024 16:23:41 +0700
Subject: <iman> update new register ubah alamat

---
 src/lib/address/components/Addresses.jsx | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'src/lib/address/components/Addresses.jsx')

diff --git a/src/lib/address/components/Addresses.jsx b/src/lib/address/components/Addresses.jsx
index a8879607..9ca617ae 100644
--- a/src/lib/address/components/Addresses.jsx
+++ b/src/lib/address/components/Addresses.jsx
@@ -149,6 +149,7 @@ const AddressCard = ({
   setSelectedForChange,
 }) => {
   const auth = useAuth();
+  const router = useRouter();
 
   return (
     <div
@@ -179,8 +180,12 @@ const AddressCard = ({
       </div>
       <button
         onClick={() => {
-          setSelectedForChange(address.id); // Set alamat yang dipilih
-          setChangeConfirmation(true); // Tampilkan popup konfirmasi
+          if (type == 'Contact Address' && auth.parentId) {
+            setSelectedForChange(address.id); // Set alamat yang dipilih
+            setChangeConfirmation(true); // Tampilkan popup konfirmasi
+          } else {
+            router.push(`/my/address/${address.id}/edit`);
+          }
         }}
         className='btn-light bg-white mt-3 w-full !text-gray_r-11'
       >
-- 
cgit v1.2.3

