diff --git a/src/components/Referral/ReferralDisplay.jsx b/src/components/Referral/ReferralDisplay.jsx index ade2c64..7d87316 100644 --- a/src/components/Referral/ReferralDisplay.jsx +++ b/src/components/Referral/ReferralDisplay.jsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { toast } from "react-toastify"; +// import { toast } from "react-toastify"; import usersService from "../../services/UsersService"; import InputCom from "../Helpers/Inputs/InputCom"; import LoadingSpinner from "../Spinners/LoadingSpinner"; @@ -84,11 +84,16 @@ function ReferralDisplay() { loading: false, status: false, }); - return; + setTimeout(()=>{ + setError({ message: '', loading: false, status: false }); + },3000) } else { - toast.success(res.data.status | "Message Sent!"); - setError({ message: "", loading: false, status: true }); + // toast.success(res.data.status | "Message Sent!"); + setError({ message: res.data.status, loading: false, status: true }); setRefHistoryReload((prev) => !prev); + setTimeout(()=>{ + setError({ message: '', loading: false, status: true }); + },3000) } }) .catch((error) => { @@ -97,6 +102,9 @@ function ReferralDisplay() { loading: false, status: false, }); + setTimeout(()=>{ + setError({ message: '', loading: false, status: false }); + },3000) }); }; @@ -228,7 +236,7 @@ function ReferralDisplay() {
{error.message != "" && ( -

{error.message}

+

{error.message}

)}
{error.loading ? ( @@ -237,6 +245,7 @@ function ReferralDisplay() { @@ -251,9 +260,12 @@ function ReferralDisplay() { {selectedTab == 'Referral List' && <>
-

- Referral List -

+
+

+ Referral List +

+

Uncompleted signup will be removed automatically after 7 days

+
{referralList.loading ? ( ) : ( diff --git a/src/middleware/AuthRoute.jsx b/src/middleware/AuthRoute.jsx index a7d5607..8176f2a 100644 --- a/src/middleware/AuthRoute.jsx +++ b/src/middleware/AuthRoute.jsx @@ -26,7 +26,6 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { const dispatch = useDispatch(); const [lastActivityTime, setLastActivityTime] = useState(Date.now()); const [isLogin, setIsLogin] = useState({ loading: true, status: false }); - const [loadProfileDetails, setLoadProfileDetails] = useState([]); const navigate = useNavigate(); const { jobListTable, marketTableList, walletTable, familyBannersListTable, homeBanners } = useSelector( @@ -48,19 +47,12 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { }; const checkInactivity = setInterval(() => { - let { account_type } = loadProfileDetails; if (account_type === "FAMILY") { - if ( - Date.now() - lastActivityTime > - process.env.REACT_APP_SESSION_EXPIRE_MINUTES_FAMILY - ) { + if (Date.now() - Number(lastActivityTime) > Number(process.env.REACT_APP_SESSION_EXPIRE_MINUTES_FAMILY)) { expireSession(); } } else { - if ( - Date.now() - lastActivityTime > - process.env.REACT_APP_SESSION_EXPIRE_MINUTES - ) { + if (Date.now() - Number(lastActivityTime) > Number(process.env.REACT_APP_SESSION_EXPIRE_MINUTES)) { expireSession(); } } @@ -70,7 +62,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { return () => { clearInterval(checkInactivity); }; - }, [lastActivityTime, navigate]); + }, [lastActivityTime, navigate, isLogin.status]); // Reset last activity time on user input const resetTime = useCallback(() => { @@ -99,7 +91,6 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { setIsLogin({ loading: false, status: false }); return; } - setLoadProfileDetails(res.data); dispatch(updateUserDetails({ ...res.data })); setIsLogin({ loading: false, status: true }); setNoCache(true) // Sets no cache to true, so as to trigger nocache whenever used in api call @@ -145,8 +136,6 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { dispatch(updateNotifications({ loading: false, data: null })); return; } - setLoadProfileDetails(res.data); - const _raw = res.data?.result_list; //Sort the notifications in ascending order based on the API time