-
- {loading ?
-
-
-
-
- : data.length > 0 ?
-
-
-
- {data.length > 1 && data.map(item =>(
-
- ))}
-
-
- {/* image */}
-
-
})
-
-
Current Balance
-
- {PriceFormatter(selectedWallet?.amount/100, selectedWallet?.code, undefined, "text-[2rem]")}
-
-
-
-
-
Recent Activities
-
+
+
+
+
+ {wallet?.loading ?
+
+
- :
-
-
No Wallet Record Found
+ : wallet?.data.length > 0 ?
+ <>
+ {wallet?.data?.length > 1 &&
+
+ {wallet?.data?.map(item =>(
+
+ ))}
+
+ }
+
+ {/* image */}
+
+
})
+
+
Current Balance
+
+ {PriceFormatter(selectedWallet?.amount/100, selectedWallet?.code, undefined, "text-[2rem]")}
+
+
+ >
+ :
+
+
No Wallet Record Found
+
+ }
- }
+
+
Recent Activities
+
+
+
+
+
-
-
-
);
diff --git a/src/components/MyWallet/FamilyWallet.jsx b/src/components/MyWallet/FamilyWalletCon.jsx
similarity index 63%
rename from src/components/MyWallet/FamilyWallet.jsx
rename to src/components/MyWallet/FamilyWalletCon.jsx
index fde783d..b8f16d2 100644
--- a/src/components/MyWallet/FamilyWallet.jsx
+++ b/src/components/MyWallet/FamilyWalletCon.jsx
@@ -6,9 +6,9 @@ import LoadingSpinner from "../Spinners/LoadingSpinner";
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
const FamilyWalletBox = lazy(() => import("./FamilyWalletBox"));
-const FamilyWallet = () => {
+const FamilyWalletCon = () => {
const apiCall = new usersService();
- const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
+ // const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
const { walletTable } = useSelector((state) => state.tableReload);
const [paymentHistory, setPaymentHistory] = useState({
@@ -16,6 +16,20 @@ const FamilyWallet = () => {
data: [],
});
+ const [familyWalletBal, setFamilyWalletBal] = useState({
+ loading: true,
+ data: []
+ });
+
+ const getFamilyWalletBal = () => {
+ setFamilyWalletBal({loading:true, data: []})
+ apiCall.getFamilyWallet({family_uid: localStorage.getItem("uid")}).then(res => {
+ setFamilyWalletBal({loading:false, data: res?.data?.result_list})
+ }).catch(error => {
+ setFamilyWalletBal({loading:false, data: []})
+ })
+ };
+
const getPaymentHistory = () => {
apiCall
.getPaymentHx()
@@ -24,6 +38,7 @@ const FamilyWallet = () => {
setPaymentHistory({ loading: false, data: [] });
} else {
setPaymentHistory({ loading: false, data: res.data?.result_list });
+ // console.log('Hist', res.data?.result_list)
}
})
.catch(() => {
@@ -33,6 +48,7 @@ const FamilyWallet = () => {
useEffect(() => {
getPaymentHistory();
+ getFamilyWalletBal()
}, [walletTable]);
return (
@@ -48,9 +64,13 @@ const FamilyWallet = () => {
}
/>
-
}>
+
+
+
+ }>
@@ -58,4 +78,4 @@ const FamilyWallet = () => {
);
};
-export default FamilyWallet;
+export default FamilyWalletCon;
diff --git a/src/components/MyWallet/FamilyWalletRedeemOptions.jsx b/src/components/MyWallet/FamilyWalletRedeemOptions.jsx
index 5d5972c..ec2e45f 100644
--- a/src/components/MyWallet/FamilyWalletRedeemOptions.jsx
+++ b/src/components/MyWallet/FamilyWalletRedeemOptions.jsx
@@ -45,7 +45,7 @@ export default function FamilyWalletRedeemOptions() {
- : Object.keys(familyWalletRedeemOptList?.data)?.length > 0 ?
+ : familyWalletRedeemOptList?.data && Object.keys(familyWalletRedeemOptList?.data)?.length > 0 ?
Object.keys(filteredRedeemData?.data)?.length ?
{ Object.keys(filteredRedeemData?.data)?.map((item)=>{
diff --git a/src/middleware/AuthRoute.jsx b/src/middleware/AuthRoute.jsx
index 7d7536c..8d5a93c 100644
--- a/src/middleware/AuthRoute.jsx
+++ b/src/middleware/AuthRoute.jsx
@@ -193,6 +193,9 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
}, [jobListTable, isLogin.status]);
useEffect(() => {
+ if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY
+ return
+ }
const getMyWalletList = async () => {
dispatch(updateWalletDetails({ loading: true, data: [] }));
try {
@@ -207,7 +210,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
}
};
getMyWalletList();
- }, [walletTable]);
+ }, [walletTable, isLogin.status]);
useEffect(() => {
if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY
@@ -245,6 +248,9 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
//FUNCTION TO GET COMMON HEAD DATA
useEffect(() => {
+ if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY
+ return
+ }
apiCall
.getRecentActivitiedData()
.then((res) => {
@@ -257,7 +263,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
.catch((error) => {
console.log("ERROR ", error);
});
- }, []);
+ }, [isLogin.status]);
//FUNCTION TO GET FAMILY BANNERS
diff --git a/src/views/FamilyWalletPage.jsx b/src/views/FamilyWalletPage.jsx
index 9a52cb9..5572e63 100644
--- a/src/views/FamilyWalletPage.jsx
+++ b/src/views/FamilyWalletPage.jsx
@@ -1,5 +1,5 @@
-import FamilyWallet from "../components/MyWallet/FamilyWallet";
+import FamilyWalletCon from "../components/MyWallet/FamilyWalletCon";
export default function FamilyWalletPage() {
- return ;
+ return ;
}