Skip to content
Snippets Groups Projects
Commit 612fb183 authored by eal's avatar eal
Browse files

Add option for disabling chat.

parent 6c4e3a50
No related branches found
No related tags found
1 merge request!182Feature/chat
Pipeline #
......@@ -82,6 +82,9 @@ window.fetch('/static/config.json')
store.dispatch('setOption', { name: 'background', value: background })
store.dispatch('setOption', { name: 'logo', value: logo })
store.dispatch('setOption', { name: 'registrationOpen', value: registrationOpen })
if (data['chatDisabled']) {
store.dispatch('disableChat')
}
const routes = [
{ name: 'root', path: '/', redirect: data['defaultPath'] || '/main/all' },
......
......@@ -6,7 +6,8 @@ const api = {
state: {
backendInteractor: backendInteractorService(),
fetchers: {},
socket: null
socket: null,
chatDisabled: false
},
mutations: {
setBackendInteractor (state, backendInteractor) {
......@@ -20,6 +21,9 @@ const api = {
},
setSocket (state, socket) {
state.socket = socket
},
setChatDisabled (state, value) {
state.chatDisabled = value
}
},
actions: {
......@@ -45,9 +49,14 @@ const api = {
},
initializeSocket (store, token) {
// Set up websocket connection
let socket = new Socket('/socket', {params: {token: token}})
socket.connect()
store.dispatch('initializeChat', socket)
if (!store.state.chatDisabled) {
let socket = new Socket('/socket', {params: {token: token}})
socket.connect()
store.dispatch('initializeChat', socket)
}
},
disableChat (store) {
store.commit('setChatDisabled', true)
}
}
}
......
......@@ -4,5 +4,6 @@
"background": "/static/bg.jpg",
"logo": "/static/logo.png",
"registrationOpen": false,
"defaultPath": "/main/all"
"defaultPath": "/main/all",
"chatDisabled": false
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment