From dbde8a9c4ce213f4af4db63604b937415c3ed093 Mon Sep 17 00:00:00 2001 From: Ivan Samozhenov Date: Sat, 13 Jan 2024 20:24:14 +0300 Subject: [PATCH] Fix socket connection before authorization if auth ends with error --- frontend/src/pages/MainPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/pages/MainPage.jsx b/frontend/src/pages/MainPage.jsx index 93d53b2..130981f 100644 --- a/frontend/src/pages/MainPage.jsx +++ b/frontend/src/pages/MainPage.jsx @@ -34,6 +34,7 @@ const MainPage = () => { dispatch(addChannels(channels)); dispatch(addMessages(messages)); setFetchStatus('idle'); + socket.connect(); } catch (err) { setFetchStatus('failed'); if (err.isAxiosError && err.code === 'ERR_NETWORK') { @@ -49,7 +50,6 @@ const MainPage = () => { }; connectToChat(); - socket.connect(); }, [auth, dispatch, navigate, socket, t]); return (fetchStatus !== 'idle') ? (