added socket event to listen to job market post
This commit is contained in:
@@ -14,8 +14,12 @@ import { updateWalletDetails } from "../store/walletDetails";
|
||||
import { familyBannersList } from "../store/FamilyBannerList";
|
||||
import { familyResources } from "../store/FamilyResources";
|
||||
import {familyWalletRedeemOptList} from '../store/FamilyWalletRedeemOpt'
|
||||
import { SocketValues } from "../components/Contexts/SocketIOContext";
|
||||
|
||||
const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
|
||||
let {joinRoom} = SocketValues() // destructures 'SEND MESSAGE' and 'JOIN ROOM' FUNCTIONS FROM SOCKET
|
||||
|
||||
const apiCall = useMemo(() => new usersService(), []);
|
||||
const dispatch = useDispatch();
|
||||
const [lastActivityTime, setLastActivityTime] = useState(Date.now());
|
||||
@@ -23,7 +27,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
const [loadProfileDetails, setLoadProfileDetails] = useState([]);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { jobListTable, walletTable, familyBannersListTable } = useSelector(
|
||||
const { jobListTable, marketTableList, walletTable, familyBannersListTable } = useSelector(
|
||||
(state) => state.tableReload
|
||||
);
|
||||
|
||||
@@ -219,7 +223,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
}
|
||||
};
|
||||
getMarketActiveJobList();
|
||||
}, [apiCall, dispatch, jobListTable, isLogin.status]);
|
||||
}, [apiCall, dispatch, marketTableList, isLogin.status]);
|
||||
|
||||
//FUNCTION TO GET COMMON HEAD DATA
|
||||
useEffect(() => {
|
||||
@@ -309,6 +313,11 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
familyWalletRedeemOptions()
|
||||
}, [isLogin.status]);
|
||||
|
||||
useEffect(()=>{ // sends an event to the socket to enable user join a room to be able to receive update when jobs enters the market
|
||||
joinRoom('full-markets-jobs')
|
||||
console.log('joined oooooooooooooooooooooooooooooooooooooooooooooooooooooooo')
|
||||
},[isLogin.status])
|
||||
|
||||
|
||||
// RENDER PAGE
|
||||
return isLogin.loading && !loggedIn ? (
|
||||
|
||||
Reference in New Issue
Block a user