From 84968b4435bcb0e50b2aadc1e151907733afe7d9 Mon Sep 17 00:00:00 2001 From: Ebube Date: Thu, 27 Jul 2023 16:28:21 +0100 Subject: [PATCH] balance refresh bug for withdraw --- .../MyWallet/Popup/ConfirmNairaWithdraw.jsx | 11 ++++------ src/components/MyWallet/Wallet.jsx | 3 --- src/components/MyWallet/WalletAction.jsx | 20 +------------------ 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx b/src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx index a42f927..011fecf 100644 --- a/src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx +++ b/src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx @@ -1,9 +1,10 @@ import { useState } from "react"; -import { useNavigate } from "react-router-dom"; import usersService from "../../../services/UsersService"; import InputCom from "../../Helpers/Inputs/InputCom"; import ModalCom from "../../Helpers/ModalCom"; import LoadingSpinner from "../../Spinners/LoadingSpinner"; +import { useDispatch } from "react-redux"; +import { tableReload } from "../../../store/TableReloads"; function ConfirmNairaWithdraw({ payment, @@ -14,7 +15,7 @@ function ConfirmNairaWithdraw({ setShowNairaWithdraw, }) { const apiURL = new usersService(); - const navigate = useNavigate(); + const dispatch = useDispatch(); let [requestStatus, setRequestStatus] = useState({ message: "", @@ -90,6 +91,7 @@ function ConfirmNairaWithdraw({ state: res.data, }); }, 5000); + dispatch(tableReload({ type: "WALLETTABLE" })); return; }) .catch((error) => { @@ -101,11 +103,6 @@ function ConfirmNairaWithdraw({ }); }; - // const completeWithdrawal = () => { - // action(); - // window.location.reload(true); - // }; - return (
diff --git a/src/components/MyWallet/Wallet.jsx b/src/components/MyWallet/Wallet.jsx index 01dcc96..a4b1042 100644 --- a/src/components/MyWallet/Wallet.jsx +++ b/src/components/MyWallet/Wallet.jsx @@ -67,9 +67,6 @@ const WalletRoutes = () => { getPaymentHistory() }, [walletTable]); - - - console.log('TESTING',walletTable); return ( }> diff --git a/src/components/MyWallet/WalletAction.jsx b/src/components/MyWallet/WalletAction.jsx index 330de08..f544471 100644 --- a/src/components/MyWallet/WalletAction.jsx +++ b/src/components/MyWallet/WalletAction.jsx @@ -8,30 +8,12 @@ function WalletAction({ walletItem, payment, openPopUp }) { show: false, state: {}, }); // DETERMINES WHEN NAIRA WITHDRAWAL POPS UP - const [countries, setCountries] = useState([]); + const [showConfirmNairaWithdraw, setShowConfirmNairaWithdraw] = useState({ show: false, state: {}, }); // DETERMINES WHEN CONFIRM NAIRA WITHDRAWAL POPS UP - const userApi = new usersService(); - - // Get Country Api - const getCountryList = useCallback(async () => { - const res = await userApi.getSignupCountryData(); - - try { - if (res.status === 200) { - const { signup_country } = await res.data; - setCountries(signup_country); - } else if (res.data.result !== 100) { - setCountries("Nothing see here!"); - } - } catch (error) { - throw new Error(error); - } - }, []); - return (