hardlounge/client/js/store.js

60 lines
1.4 KiB
JavaScript
Raw Normal View History

import Vue from "vue";
import Vuex from "vuex";
const storage = require("./localStorage");
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: [],
sidebarOpen: false,
2019-08-05 12:24:44 +00:00
sidebarDragging: false,
userlistOpen: storage.get("thelounge.state.userlist") !== "false",
2019-08-05 14:29:35 +00:00
versionData: null,
versionStatus: "loading",
versionDataExpired: 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;
},
currentNetworkConfig(state, payload) {
state.currentNetworkConfig = payload;
},
2019-03-03 17:47:49 +00:00
sessions(state, payload) {
state.sessions = payload;
},
sidebarOpen(state, payload) {
state.sidebarOpen = payload;
},
2019-08-05 12:24:44 +00:00
sidebarDragging(state, payload) {
state.sidebarDragging = payload;
},
userlistOpen(state, payload) {
state.userlistOpen = payload;
},
2019-08-05 14:29:35 +00:00
versionData(state, payload) {
state.versionData = payload;
},
versionStatus(state, payload) {
state.versionStatus = payload;
},
versionDataExpired(state, payload) {
state.versionDataExpired = 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),
},
});