initial commit
This commit is contained in:
@@ -36,6 +36,12 @@ export default function SocketIOContextProvider({children}) {
|
||||
}
|
||||
};
|
||||
|
||||
const parentAssignJobToKid = (message, room) => {
|
||||
if(message && room){
|
||||
socket.emit("family", { message:{...message}, room });
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
socket.on("receive_message", (data) => {
|
||||
// setSocketMsgReceived(data.message);
|
||||
@@ -45,6 +51,11 @@ export default function SocketIOContextProvider({children}) {
|
||||
// setSocketMsgReceived(data.message);
|
||||
dispatch(tableReload({type:'MARKETTABLELIST'}))
|
||||
});
|
||||
socket.on("family_actions", (data) => {
|
||||
// setSocketMsgReceived(data.message);
|
||||
// dispatch(tableReload({type:'MARKETTABLELIST'}))
|
||||
console.log('working')
|
||||
});
|
||||
}, [socket]);
|
||||
|
||||
let values = {
|
||||
@@ -52,8 +63,8 @@ export default function SocketIOContextProvider({children}) {
|
||||
sendMessage,
|
||||
joinRoom,
|
||||
setSocketMsgReceived,
|
||||
socketMsgReceived,
|
||||
marketUpdate,
|
||||
socketMsgReceived,
|
||||
// room,
|
||||
// setRoom,
|
||||
// message,
|
||||
|
||||
@@ -32,7 +32,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
);
|
||||
|
||||
const {
|
||||
userDetails: { username, uid, session, account_type },
|
||||
userDetails: { username, uid, session, account_type, parent_uid },
|
||||
} = 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
|
||||
@@ -323,6 +323,11 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
joinRoom('full-markets-jobs')
|
||||
},[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])
|
||||
|
||||
|
||||
// RENDER PAGE
|
||||
return isLogin.loading && !loggedIn ? (
|
||||
|
||||
Reference in New Issue
Block a user