From 0fd2f8f53ac25c298f798e99869e0c4cf8af060f Mon Sep 17 00:00:00 2001 From: Michael Yankelev Date: Fri, 4 Mar 2022 20:09:57 +0100 Subject: [PATCH] fix dialog closing instead of going to success --- .../Settings/SubscriptionTab/Common/CryptoPayment.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx index 5789d338a5..ea53c2b8e9 100644 --- a/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx +++ b/packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/Common/CryptoPayment.tsx @@ -359,32 +359,29 @@ const CryptoPayment = ({ planPrice, onClose, onSuccess }: ICryptoPayment) => { if (!provider || !selectedCurrency || !selectedPaymentMethod) return const signer = provider.getSigner() - let transferSuccess = false try { setTransferActive(true) if (selectedCurrency === "ethereum") { await (await signer.sendTransaction({ to: selectedPaymentMethod.address, value: utils.parseEther(selectedPaymentMethod.amount) - })).wait(5) + })).wait(1) } else { const token = Object.values(tokens).find(t => t.symbol?.toLowerCase() === selectedCurrency) if (!token || !token.transfer) return await (await token.transfer( selectedPaymentMethod.address, utils.parseUnits(selectedPaymentMethod.amount, token.decimals) - )).wait(5) + )).wait(1) } await fetchCurrentSubscription() - transferSuccess = true onSuccess() } catch (error) { console.error(error) } finally { setTransferActive(false) - transferSuccess && onClose() } - }, [fetchCurrentSubscription, onClose, onSuccess, provider, selectedCurrency, selectedPaymentMethod, tokens]) + }, [fetchCurrentSubscription, onSuccess, provider, selectedCurrency, selectedPaymentMethod, tokens]) const handleSwitchNetwork = useCallback(async () => { await switchNetwork(1)