summaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorRafi Zadanly <rafizadanly@gmail.com>2022-12-29 15:41:49 +0700
committerRafi Zadanly <rafizadanly@gmail.com>2022-12-29 15:41:49 +0700
commit502fac23304b29ced974ec0c8f30ae204eda88cd (patch)
treebfe2632dbbac69e7adcd7270091d131ff4c2518b /src/pages
parent5ddbc2e832c80ff053abbedf54cd6689aa94ae1f (diff)
no message
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/shop/checkout.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/pages/shop/checkout.js b/src/pages/shop/checkout.js
index 8522d27b..3eea9e74 100644
--- a/src/pages/shop/checkout.js
+++ b/src/pages/shop/checkout.js
@@ -1,4 +1,4 @@
-import { DocumentDuplicateIcon, ExclamationCircleIcon } from "@heroicons/react/24/solid";
+import { ExclamationCircleIcon } from "@heroicons/react/24/solid";
import { useEffect, useState } from "react";
import { toast } from "react-hot-toast";
import Alert from "../../components/Alert";
@@ -30,15 +30,16 @@ export default function Checkout() {
{ name: 'MANDIRI', number: '155-0067-6869-75' },
];
- const copyToClipboard = (text) => {
- navigator.clipboard.writeText(text);
- };
-
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 });
+ navigator.clipboard.writeText(text)
+ .then(() => {
+ toast.success('Nomor bank berhasil disalin', { position: 'bottom-center', duration: 1500 });
+ })
+ .catch((e) => {
+ toast.error(e, { position: 'bottom-center', duration: 10000 });
+ });
} else {
toast.success('Metode pembayaran berhasil diubah, tekan sekali lagi untuk salin nomor bank', { position: 'bottom-center', duration: 3000 });
}