cache banner API using redux
This commit was merged in pull request #580.
This commit is contained in:
@@ -11,6 +11,7 @@ import { updateJobs } from "../store/jobLists";
|
||||
import { updateNotifications } from "../store/notifications";
|
||||
import { updateUserJobList } from "../store/userJobList";
|
||||
import { updateWalletDetails } from "../store/walletDetails";
|
||||
import { familyBannersList } from "../store/FamilyBannerList";
|
||||
|
||||
const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
const apiCall = useMemo(() => new usersService(), []);
|
||||
@@ -20,7 +21,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
const [loadProfileDetails, setLoadProfileDetails] = useState([]);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { jobListTable, walletTable } = useSelector(
|
||||
const { jobListTable, walletTable, familyBannersListTable } = useSelector(
|
||||
(state) => state.tableReload
|
||||
);
|
||||
|
||||
@@ -252,6 +253,24 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
||||
//FUNCTION TO GET FAMILY BANNERS
|
||||
useEffect(() => {
|
||||
if((!loggedIn && !isLogin.status) || account_type == 'FULL'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FULL
|
||||
return
|
||||
}
|
||||
const getFamilyBanners = async () => { // FUNCTION TO GET FAMILY BANNERS
|
||||
// setFamilyBannersList({loading:true, result:[]});
|
||||
try {
|
||||
const res = await apiCall.getFamilyBannersList();
|
||||
dispatch(familyBannersList(res.data))
|
||||
} catch (error) {
|
||||
console.log("Error getting tasks");
|
||||
}
|
||||
};
|
||||
getFamilyBanners()
|
||||
}, [isLogin.status, familyBannersListTable]);
|
||||
|
||||
// useEffect(() => {
|
||||
// apiCall
|
||||
// .getHeroJBanners()
|
||||
|
||||
Reference in New Issue
Block a user