Abort web socket requests when no token is present
This commit is contained in:
parent
090142c281
commit
1e33fd0ea4
|
|
@ -35,6 +35,10 @@ export function deleteMessage(id) {
|
|||
* Starts listening to the stream for new messages.
|
||||
*/
|
||||
export function listenToWebSocket() {
|
||||
if (!getToken()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ws = new WebSocket('ws://localhost:80/stream?token=' + getToken());
|
||||
|
||||
ws.onerror = (e) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue