From 6a9e4aaaf73677b3b0650e93560c6738781f76c2 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 8 Jul 2024 15:13:01 +0700
Subject: <iman> update button salin voucher

---
 src-migrate/modules/promo/components/Voucher.tsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src-migrate/modules/promo/components/Voucher.tsx')

diff --git a/src-migrate/modules/promo/components/Voucher.tsx b/src-migrate/modules/promo/components/Voucher.tsx
index c978dc7b..b5a25aa9 100644
--- a/src-migrate/modules/promo/components/Voucher.tsx
+++ b/src-migrate/modules/promo/components/Voucher.tsx
@@ -28,7 +28,8 @@ const Voucher = () => {
   
   const vouchers = useMemo(() => voucherQuery.data || [], [voucherQuery.data]);
 
-  const copyText = (text: string) => {
+  const copyText = (text: string, event: React.MouseEvent<HTMLButtonElement>) => {
+    event.preventDefault();
     if (navigator.clipboard && navigator.clipboard.writeText) {
       navigator.clipboard.writeText(text)
         .then(() => {
@@ -100,7 +101,7 @@ const Voucher = () => {
                         <div className={style['voucher-code-desc']}>Kode Promo</div>
                         <div className={style['voucher-code']}>{voucher.code}</div>
                       </div>
-                      <button className={style['voucher-copy']} onClick={() => copyText(voucher.code)}>Salin</button>
+                      <button className={style['voucher-copy']} onClick={(event) => copyText(voucher.code, event)}>Salin</button>
                     </div>
                   </div>
                 </div>
-- 
cgit v1.2.3

