deemix-webui/src/utils/socket.js

30 lines
741 B
JavaScript
Raw Normal View History

import store from '@/store'
export const socket = io.connect(window.location.href)
socket.on('connect', () => {
document.getElementById('start_app_placeholder').classList.add('loading_placeholder--hidden')
})
socket.on('init_charts', charts => {
store.dispatch('cacheCharts', charts)
})
socket.on('init_favorites', favorites => {
store.dispatch('setFavorites', favorites)
})
2020-08-24 19:30:54 +00:00
socket.on('init_settings', (settings, credentials, defaults) => {
store.dispatch('setSettings', settings)
store.dispatch('setDefaultSettings', defaults)
store.dispatch('setCredentials', credentials)
2020-08-24 19:30:54 +00:00
})
socket.on('init_home', data => {
store.dispatch('cacheHomeData', data)
})
2020-09-15 16:11:29 +00:00
socket.on('init_update', data => {
store.dispatch('setAboutInfo', data)
})