From fb4939946ee16f050cddcec3e1635b3565e9521b Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Wed, 3 May 2023 23:49:56 +0100 Subject: [PATCH 1/2] loadprofile loop bug fixed --- src/components/FourZeroFour/index.jsx | 4 +- .../Settings/Tabs/PersonalInfoTab.jsx | 131 +++++++----------- src/middleware/AuthRoute.jsx | 5 +- 3 files changed, 52 insertions(+), 88 deletions(-) diff --git a/src/components/FourZeroFour/index.jsx b/src/components/FourZeroFour/index.jsx index 24977e2..fccca38 100644 --- a/src/components/FourZeroFour/index.jsx +++ b/src/components/FourZeroFour/index.jsx @@ -1,5 +1,5 @@ import React from "react"; -import Lottie from "react-lottie"; +// import Lottie from "react-lottie"; import { useNavigate } from "react-router-dom"; import * as animationData from "../../assets/images/Lotties/77618-website-404-error-animation.json"; @@ -16,7 +16,7 @@ export default function FourZeroFour() { return (
- + {/* */}
:
- + {(props => { return (
- { - profile.data.length ? - profile.data.map((item, index) => ( -
+ +
{/* inputs starts here */} @@ -153,7 +126,7 @@ export default function PersonalInfoTab({ type="text" name="username" placeholder="" - value={item.username} + value={userDetails.username} disable={true} />
@@ -205,7 +178,7 @@ export default function PersonalInfoTab({ label="Country" type="text" name="country" - value={item.country} + value={userDetails.country} disable={true} />
@@ -324,41 +297,35 @@ export default function PersonalInfoTab({
-
- )) - : - profile.status ? -
No User Information Found!
- : -
Opps! something went wrong. Try Again Later!
- } -
- {requestStatus.message != '' &&

{requestStatus.message}

} -
-
- - - {" "} - Cancel - - +
- {requestStatus.loading ? - - : - - } +
+ {requestStatus.message != '' &&

{requestStatus.message}

} +
+
+ + + {" "} + Cancel + + + + {requestStatus.loading ? + + : + + } +
-
) })} diff --git a/src/middleware/AuthRoute.jsx b/src/middleware/AuthRoute.jsx index f57ec6e..7629db3 100644 --- a/src/middleware/AuthRoute.jsx +++ b/src/middleware/AuthRoute.jsx @@ -46,13 +46,10 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { setIsLogin({loading: false, status: false}) }) } - const getProfile = useCallback(()=>{ - loadProfile() // API CALL TO GET USER PROFILE - }, []) useEffect(() => { if(!isLogin.status){ - getProfile() + loadProfile() // LOADS USER PROFILE DETAILS AND CALLS DISPATCH UPDATEUSERDETAILS TO UPDATE USERDETAILS SLICE IN STORE } const checkInactivity = setInterval(() => { From a50b9f0026e35e49f6557ef9c25a82aa0213ea56 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Thu, 4 May 2023 12:09:18 +0100 Subject: [PATCH 2/2] 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()