added socket context

This commit was merged in pull request #17.
This commit is contained in:
victorAnumudu
2024-03-14 10:42:57 +01:00
parent df80cf8aae
commit a52479e11f
8 changed files with 197 additions and 105 deletions
+10
View File
@@ -1,9 +1,19 @@
import { useEffect } from 'react';
import Routes from './Routes';
import { Redirect, useLocation } from 'react-router-dom';
import { SocketValues } from './Contexts/SocketIOContext';
function App() {
let { joinRoom } = SocketValues() // function to join market room, to be able to receive market job post update
const {pathname} = useLocation()
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('market room joined')
},[])
return (
<>
{pathname.startsWith('/@') ?