Skip to content

Commit

Permalink
onChanging network showing alert, and when alert is clicked ok, page …
Browse files Browse the repository at this point in the history
…get reloaded
  • Loading branch information
himanshuNegi755 committed Dec 4, 2020
1 parent 21647e7 commit 61f413f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/src/components/Chat/Chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ const Chat = ({ location, user }) => {
if(navigator.onLine) {
setOnline(true);

if(!socket.connected) {
if(!alert('you got disconnected')){window.location.reload();}
/*if(!socket.connected) {
const { room, roomId } = queryString.parse(location.search);
socket = io(process.env.REACT_APP_SOCKET_ENDPOINT, {transports: ['websocket', 'polling', 'flashsocket']});
Expand All @@ -191,7 +192,7 @@ const Chat = ({ location, user }) => {
.then(res => { setMessages(res.data) })
}
});
}
}*/
} else { setOnline(false); }
}

Expand Down

0 comments on commit 61f413f

Please sign in to comment.