Commit a67881b0 authored by slice's avatar slice

Check for websocket token before connecting to chat

Closes #403. Previously, a socket to the chat channel would be opened if
chat is enabled, regardless if the user is logged in or not. This patch
only allows a connection to be opened if a wsToken (websocket token) is
present, which prevents websocket errors from unauthenticated users.
parent 09736691
......@@ -50,7 +50,7 @@ const api = {
},
initializeSocket (store) {
// Set up websocket connection
if (!store.state.chatDisabled) {
if (!store.state.chatDisabled && store.state.wsToken) {
const token = store.state.wsToken
const socket = new Socket('/socket', {params: {token}})
socket.connect()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment