all files / src/stores/ index.js

10% Statements 1/10
100% Branches 0/0
0% Functions 0/3
10% Lines 1/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50                                                                                                 
import Vue from 'vue'
import Vuex from 'vuex'
 
import chat from './modules/chat'
import files from './modules/files'
import project from './modules/project'
 
Vue.use(Vuex)
 
export default new Vuex.Store({
  strict: process.env.NODE_ENV !== 'production',
  modules: {
    chat,
    files,
    project
  },
  state: {
    server: null,
    isConnecting: false,
    isLoading: false
  },
  getters: {
    server: state => state.server,
    isConnecting: state => state.isConnecting,
    isLoading: state => state.isLoading
  },
  mutations: {
    SET_SERVER (state, data) {
      state.server = data
    },
    SET_CONNECT (state, data) {
      state.isConnecting = data
    },
    SET_LOADING (state, data) {
      state.isLoading = data
    }
  },
  actions: {
    setServer ({ commit }, data) {
      commit('SET_SERVER', data)
    },
    setConnect ({ commit }, data) {
      commit('SET_CONNECT', !!data)
    },
    setLoading ({ commit }, data) {
      commit('SET_LOADING', !!data)
    }
  }
})