Skip to content

Commit

Permalink
Fix socket connection before authorization if auth ends with error
Browse files Browse the repository at this point in the history
  • Loading branch information
SamIvan-ark committed Jan 13, 2024
1 parent 9b87a78 commit dbde8a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/pages/MainPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -49,7 +50,6 @@ const MainPage = () => {
};

connectToChat();
socket.connect();
}, [auth, dispatch, navigate, socket, t]);
return (fetchStatus !== 'idle') ? (
<div className="d-flex justify-content-center align-items-center h-100">
Expand Down

0 comments on commit dbde8a9

Please sign in to comment.