From 5ddbc2e832c80ff053abbedf54cd6689aa94ae1f Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 29 Dec 2022 15:35:07 +0700 Subject: Copy nomor bank --- src/pages/shop/checkout.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/pages') diff --git a/src/pages/shop/checkout.js b/src/pages/shop/checkout.js index 00e68296..8522d27b 100644 --- a/src/pages/shop/checkout.js +++ b/src/pages/shop/checkout.js @@ -32,9 +32,19 @@ export default function Checkout() { const copyToClipboard = (text) => { navigator.clipboard.writeText(text); - toast.success('Berhasil copy ke clipboard', { position: 'bottom-center', duration: 1500 }); }; + const changePayment = (index) => { + let payment = payments[index]; + if (selectedPayment == payment.name) { + copyToClipboard(payment.number); + toast.success('Nomor bank berhasil disalin', { position: 'bottom-center', duration: 1500 }); + } else { + toast.success('Metode pembayaran berhasil diubah, tekan sekali lagi untuk salin nomor bank', { position: 'bottom-center', duration: 3000 }); + } + setSelectedPayment(payment.name); + } + useEffect(() => { const getAddress = async () => { if (auth?.id) { @@ -198,13 +208,10 @@ export default function Checkout() { )) } -- cgit v1.2.3