From 0fbbf38d6c6d6c72561c527fb8d9b45c80eb38c8 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Fri, 1 Nov 2024 22:27:24 +0100 Subject: [PATCH] virtual card country fixed --- src/components/MarketPlace/index.jsx | 3 ++- src/components/MyWallet/Wallet.jsx | 11 ++++++++++- .../MyWallet/walletvirtual/VirtualAddCardPopout.jsx | 2 +- src/middleware/AuthRoute.jsx | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/MarketPlace/index.jsx b/src/components/MarketPlace/index.jsx index 42255fe..06121a3 100644 --- a/src/components/MarketPlace/index.jsx +++ b/src/components/MarketPlace/index.jsx @@ -15,9 +15,10 @@ export default function MarketPlace({ commonHeadData }) { const marketData = jobLists?.result_list; const categories = jobLists?.categories; const image_server = jobLists?.session_image_server; + console.log('Lenth', marketData?.length ) useEffect(()=>{ - if(marketData?.length < 1 && !jobLists.loading){ + if(!jobLists.loading && (marketData?.length < 1 || !marketData)){ dispatch(tableReload({ type: "MARKETTABLELIST" })); // reloads market page } },[]) diff --git a/src/components/MyWallet/Wallet.jsx b/src/components/MyWallet/Wallet.jsx index 63cdf45..04558c7 100644 --- a/src/components/MyWallet/Wallet.jsx +++ b/src/components/MyWallet/Wallet.jsx @@ -1,11 +1,14 @@ import React, { useEffect, useState } from "react"; -import { useSelector } from "react-redux"; +import { useSelector, useDispatch } from "react-redux"; import usersService from "../../services/UsersService"; import Layout from "../Partials/Layout"; import LoadingSpinner from "../Spinners/LoadingSpinner"; import WalletBox from "./WalletBox"; +import { tableReload } from '../../store/TableReloads'; const WalletRoutes = () => { + const dispatch = useDispatch() + const apiCall = new usersService(); const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE const { walletTable } = useSelector((state) => state.tableReload); @@ -60,6 +63,12 @@ const WalletRoutes = () => { getPaymentHistory(); }, [walletTable]); + useEffect(()=>{ + if(!walletDetails.loading && walletDetails?.data?.length < 1){ + dispatch(tableReload({ type: "WALLETTABLE" })); // reloads wallet page + } + },[]) + return ( { const { userDetails } = useSelector((state) => state.userDetails); - const countryCode = userDetails?.country + const countryCode = walletItem?.country const userApi = new usersService() diff --git a/src/middleware/AuthRoute.jsx b/src/middleware/AuthRoute.jsx index 2553ff2..ae65f40 100644 --- a/src/middleware/AuthRoute.jsx +++ b/src/middleware/AuthRoute.jsx @@ -211,6 +211,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { getMyJobList(); }, [jobListTable, isLogin.status]); + //FUNCTION TO GET FULL USER WALLETS useEffect(() => { if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY return -- 2.34.1