diff --git a/README.md b/README.md index ba40e22..8137997 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ Heres a brief description about the firegex structure: - [Frontend (React)](frontend/README.md) - [Backend (FastAPI + C++)](backend/README.md) +More specific information about how Firegex works, and in particular about the nfproxy module, are available here (in italian only): [https://github.com/domysh/engineering-thesis](https://github.com/domysh/engineering-thesis) (PDF in the release attachments) + ![Firegex Working Scheme](docs/FiregexInternals.png) ### Main Points of Firegex diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index d346485..12b4260 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -21,7 +21,25 @@ function App() { const [reqError, setReqError] = useState() const [error, setError] = useState() const [loadinBtn, setLoadingBtn] = useState(false); - + const queryClient = useQueryClient() + + useEffect(()=>{ + socketio.auth = { token: localStorage.getItem("access_token") } + socketio.connect() + getStatus() + socketio.on("update", (data) => { + queryClient.invalidateQueries({ queryKey: data }) + }) + socketio.on("connect_error", (err) => { + errorNotify("Socket.Io connection failed! ",`Error message: [${err.message}]`) + getStatus() + }); + return () => { + socketio.off("update") + socketio.off("connect_error") + socketio.disconnect() + } +},[]) const getStatus = () =>{ getstatus().then( res =>{ @@ -140,26 +158,6 @@ function App() { const PageRouting = ({ getStatus }:{ getStatus:()=>void }) => { - const queryClient = useQueryClient() - - useEffect(()=>{ - socketio.auth = { token: localStorage.getItem("access_token") } - socketio.connect() - getStatus() - socketio.on("update", (data) => { - queryClient.invalidateQueries({ queryKey: data }) - }) - socketio.on("connect_error", (err) => { - errorNotify("Socket.Io connection failed! ",`Error message: [${err.message}]`) - getStatus() - }); - return () => { - socketio.off("update") - socketio.off("connect_error") - socketio.disconnect() - } -},[]) - return }> } >