From c719c15b2bd9e92f2b5ae952f500aaa9e954e95b Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Mon, 30 Sep 2024 12:01:01 +0100 Subject: [PATCH] made home banner API load after login --- src/middleware/AuthRoute.jsx | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/middleware/AuthRoute.jsx b/src/middleware/AuthRoute.jsx index b373a1f..fa9778f 100644 --- a/src/middleware/AuthRoute.jsx +++ b/src/middleware/AuthRoute.jsx @@ -111,6 +111,24 @@ 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 + .getHeroJBanners() + .then((res) => { + if (res.data?.internal_return < 0) { + return; + } + dispatch(commonHeadBanner(res.data)); + }) + .catch((error) => { + console.log("ERROR ", error); + }); + }, [isLogin.status, homeBanners]); + useEffect(() => { // FUNCTION TO GET NOTIFICATIONS LIST const notifications = () => { // function to load user notification @@ -231,24 +249,6 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { getMarketActiveJobList(); }, [apiCall, dispatch, marketTableList, isLogin.status]); - //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 - .getHeroJBanners() - .then((res) => { - if (res.data?.internal_return < 0) { - return; - } - dispatch(commonHeadBanner(res.data)); - }) - .catch((error) => { - console.log("ERROR ", error); - }); - }, [isLogin.status, homeBanners]); - //FUNCTION TO GET COMMON HEAD DATA // useEffect(() => { // if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY