2019-02-26 20:23:41 +00:00
|
|
|
import Vue from "vue";
|
|
|
|
import Vuex from "vuex";
|
2019-04-13 20:44:04 +00:00
|
|
|
const storage = require("./localStorage");
|
2019-02-26 20:23:41 +00:00
|
|
|
|
|
|
|
Vue.use(Vuex);
|
|
|
|
|
|
|
|
export default new Vuex.Store({
|
2019-02-27 14:15:34 +00:00
|
|
|
state: {
|
|
|
|
isConnected: false,
|
|
|
|
isNotified: false,
|
2019-02-27 18:15:58 +00:00
|
|
|
activeWindow: null,
|
2019-03-03 17:47:49 +00:00
|
|
|
sessions: [],
|
2019-04-13 20:44:04 +00:00
|
|
|
sidebarOpen: false,
|
|
|
|
userlistOpen: storage.get("thelounge.state.userlist") !== "false",
|
2019-02-27 14:15:34 +00:00
|
|
|
},
|
|
|
|
mutations: {
|
|
|
|
isConnected(state, payload) {
|
|
|
|
state.isConnected = payload;
|
|
|
|
},
|
|
|
|
isNotified(state, payload) {
|
|
|
|
state.isNotified = payload;
|
|
|
|
},
|
2019-02-27 18:15:58 +00:00
|
|
|
activeWindow(state, payload) {
|
|
|
|
state.activeWindow = payload;
|
|
|
|
},
|
2019-03-01 13:29:00 +00:00
|
|
|
currentNetworkConfig(state, payload) {
|
|
|
|
state.currentNetworkConfig = payload;
|
|
|
|
},
|
2019-03-03 17:47:49 +00:00
|
|
|
sessions(state, payload) {
|
|
|
|
state.sessions = payload;
|
|
|
|
},
|
2019-04-13 20:44:04 +00:00
|
|
|
sidebarOpen(state, payload) {
|
|
|
|
state.sidebarOpen = payload;
|
|
|
|
},
|
|
|
|
userlistOpen(state, payload) {
|
|
|
|
state.userlistOpen = payload;
|
|
|
|
},
|
2019-03-03 17:47:49 +00:00
|
|
|
},
|
|
|
|
getters: {
|
|
|
|
currentSession: (state) => state.sessions.find((item) => item.current),
|
|
|
|
otherSessions: (state) => state.sessions.filter((item) => !item.current),
|
2019-03-01 13:29:00 +00:00
|
|
|
},
|
2019-02-26 20:23:41 +00:00
|
|
|
});
|