parent assign job triggers update in child account

This commit was merged in pull request #648.
This commit is contained in:
victorAnumudu
2024-03-18 21:38:41 +01:00
parent 75b5102766
commit ae346d5ac5
7 changed files with 37 additions and 19 deletions
+9 -9
View File
@@ -36,14 +36,11 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
let loggedIn = username && session && uid ? true : false; // variable to determine if user is logged in
useEffect(() => {
//Removing Data stored at localStorage after session expires
const expireSession = () => {
localStorage.removeItem("uid");
localStorage.removeItem("member_id");
localStorage.removeItem("session_token");
sessionStorage.removeItem("family_uid");
sessionStorage.clear();
localStorage.clear();
navigate("/login", { replace: true }); // redirects user to login page after session expires
};
@@ -109,6 +106,8 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
});
};
loadProfile();
}else{
setIsLogin({ loading: false, status: true });
}
}, []);
@@ -324,10 +323,11 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
},[isLogin.status])
useEffect(()=>{ // sends an event to the socket to enable user join a room to be able to receive update for parent child job assign
joinRoom(`FAMILY-${account_type == 'FULL' ? uid : parent_uid}`)
console.log(`Room joined for parent child task assign as ${account_type} with ${account_type == 'FULL' ? uid : parent_uid}}, => ${uid}, ${parent_uid}`)
},[isLogin.status])
if(loggedIn || isLogin.status){
joinRoom(`FAMILY-${account_type == 'FULL' ? uid : sessionStorage.getItem('parent_uid')}`)
console.log(`Room joined for parent child task assign as ${account_type} with ${account_type == 'FULL' ? uid : sessionStorage.getItem('parent_uid')}}`)
}
},[isLogin.status])
// RENDER PAGE
return isLogin.loading && !loggedIn ? (