From a50b9f0026e35e49f6557ef9c25a82aa0213ea56 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Thu, 4 May 2023 12:09:18 +0100 Subject: [PATCH] force page to reload after successful transaction --- src/components/MyWallet/AddRecipient.jsx | 2 +- src/components/MyWallet/ConfirmAddFund.jsx | 3 ++- src/components/MyWallet/ConfirmTransfer.jsx | 5 +++-- src/components/Settings/Tabs/PersonalInfoTab.jsx | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/MyWallet/AddRecipient.jsx b/src/components/MyWallet/AddRecipient.jsx index b2e176a..bf0965c 100644 --- a/src/components/MyWallet/AddRecipient.jsx +++ b/src/components/MyWallet/AddRecipient.jsx @@ -108,7 +108,7 @@ function AddRecipient() { } // setRequestStatus({message: 'Recipient Added Successfully!', loading: false, status: true}) toast.success("Recipient Added Successfully!"); - setTimeout(()=>{navigate('../transfer-fund',{replace:true})},1000) + setTimeout(()=>{navigate('/my-wallet/transfer-fund',{replace:true})},1000) }).catch((error)=>{ setRequestStatus({message: 'Opps! an error occured! Try again later', loading: false, status: false}) }) diff --git a/src/components/MyWallet/ConfirmAddFund.jsx b/src/components/MyWallet/ConfirmAddFund.jsx index 8f45f30..7532948 100644 --- a/src/components/MyWallet/ConfirmAddFund.jsx +++ b/src/components/MyWallet/ConfirmAddFund.jsx @@ -39,6 +39,7 @@ function ConfirmAddFund({payment}) { toast.success('Account Topup was sucessful') setTimeout(()=>{ navigate('/my-wallet', {replace: true}) + window.location.reload(true) }, 1000) }).catch(err => { // do something @@ -78,7 +79,7 @@ function ConfirmAddFund({payment}) { useEffect(()=>{ // what happens if not state redirect user if(!state){ - navigate('../add-fund',{replace: true}) + navigate('/my-wallet/add-fund',{replace: true}) }else{ setPageLoading(false) } diff --git a/src/components/MyWallet/ConfirmTransfer.jsx b/src/components/MyWallet/ConfirmTransfer.jsx index a0ef9bd..f125bdd 100644 --- a/src/components/MyWallet/ConfirmTransfer.jsx +++ b/src/components/MyWallet/ConfirmTransfer.jsx @@ -34,7 +34,8 @@ function ConfirmTransfer({payment, wallet}) { setRequestStatus({message: 'transfer successful', loading: false, status: true}) toast.success('Transfer sucessful') setTimeout(()=>{ - navigate('/', {replace: true}) + navigate('/my-wallet', {replace: true}) + window.location.reload(true) }, 1000) }).catch(error=>{ setRequestStatus({message: 'Opps! something went wrong! Try Again', loading: false, status: false}) @@ -44,7 +45,7 @@ function ConfirmTransfer({payment, wallet}) { useEffect(()=>{ // what happens if not state redirect user if(!state){ - navigate('../transfer-fund',{replace: true}) + navigate('/my-wallet/transfer-fund',{replace: true}) }else{ setPageLoading(false) } diff --git a/src/components/Settings/Tabs/PersonalInfoTab.jsx b/src/components/Settings/Tabs/PersonalInfoTab.jsx index 0278c67..59b3cb0 100644 --- a/src/components/Settings/Tabs/PersonalInfoTab.jsx +++ b/src/components/Settings/Tabs/PersonalInfoTab.jsx @@ -51,7 +51,7 @@ export default function PersonalInfoTab({ }) { let {userDetails} = useSelector((state) => state.userDetails) - console.log('USERDETAILS', userDetails) + const apiCall = new usersService() let navigate = useNavigate()