family banner reload on parent task assignment

This commit is contained in:
victorAnumudu
2024-11-29 05:07:59 +01:00
parent 8e9ae8187f
commit 997985a45d
3 changed files with 11 additions and 2 deletions
+8 -1
View File
@@ -20,6 +20,8 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
let {joinRoom} = SocketValues() // destructures 'SEND MESSAGE' and 'JOIN ROOM' FUNCTIONS FROM SOCKET
const [nocache, setNoCache] = useState(false) // holds cache/nocache value
const apiCall = useMemo(() => new usersService(), []);
const dispatch = useDispatch();
const [lastActivityTime, setLastActivityTime] = useState(Date.now());
@@ -100,6 +102,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
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
})
.catch((error) => {
setIsLogin({ loading: false, status: false });
@@ -108,6 +111,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
loadProfile();
}else{
setIsLogin({ loading: false, status: true });
setNoCache(true) // Sets no cache to true, so as to trigger nocache whenever used in api call
}
}, []);
@@ -280,8 +284,11 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
}
const getFamilyBanners = async () => { // FUNCTION TO GET FAMILY BANNERS
// setFamilyBannersList({loading:true, result:[]});
dispatch(familyBannersList({loading:true}))
const noCache = (isLogin.status && nocache )? 1 : 0
const reqData = {nocache: noCache}
try {
const res = await apiCall.getFamilyBannersList();
const res = await apiCall.getFamilyBannersList(reqData);
dispatch(familyBannersList({...res?.data, loading:false}))
} catch (error) {
dispatch(familyBannersList({loading:false}))