Move activeWindow to vuex.
This commit is contained in:
parent
0da059118d
commit
c4a3108dc0
@ -12,7 +12,7 @@
|
||||
:network="activeChannel.network"
|
||||
:channel="activeChannel.channel" />
|
||||
<component
|
||||
:is="activeWindow"
|
||||
:is="$store.state.activeWindow"
|
||||
ref="window" />
|
||||
</article>
|
||||
</div>
|
||||
|
@ -128,7 +128,7 @@ window.vueMounted = () => {
|
||||
}
|
||||
|
||||
if (channel) {
|
||||
vueApp.activeWindow = null;
|
||||
vueApp.$store.commit("activeWindow", null);
|
||||
vueApp.activeChannel = channel;
|
||||
|
||||
if (channel) {
|
||||
@ -143,7 +143,7 @@ window.vueMounted = () => {
|
||||
}
|
||||
} else {
|
||||
vueApp.activeChannel = null;
|
||||
vueApp.activeWindow = target;
|
||||
vueApp.$store.commit("activeWindow", target);
|
||||
}
|
||||
|
||||
utils.synchronizeNotifiedState();
|
||||
|
@ -20,7 +20,7 @@ socket.on("auth", function(data) {
|
||||
if (data.serverHash > -1) {
|
||||
utils.serverHash = data.serverHash;
|
||||
|
||||
vueApp.activeWindow = "SignIn";
|
||||
vueApp.$store.commit("activeWindow", "SignIn");
|
||||
} else {
|
||||
getActiveWindowComponent().inFlight = false;
|
||||
}
|
||||
@ -29,7 +29,7 @@ socket.on("auth", function(data) {
|
||||
const user = storage.get("user");
|
||||
|
||||
if (!data.success) {
|
||||
if (vueApp.activeWindow !== "SignIn") {
|
||||
if (vueApp.$store.state.activeWindow !== "SignIn") {
|
||||
socket.disconnect();
|
||||
vueApp.$store.commit("isConnected", false);
|
||||
vueApp.currentUserVisibleError = "Authentication failed, reloading…";
|
||||
|
@ -7,6 +7,7 @@ export default new Vuex.Store({
|
||||
state: {
|
||||
isConnected: false,
|
||||
isNotified: false,
|
||||
activeWindow: null,
|
||||
},
|
||||
mutations: {
|
||||
isConnected(state, payload) {
|
||||
@ -15,5 +16,8 @@ export default new Vuex.Store({
|
||||
isNotified(state, payload) {
|
||||
state.isNotified = payload;
|
||||
},
|
||||
activeWindow(state, payload) {
|
||||
state.activeWindow = payload;
|
||||
},
|
||||
}
|
||||
});
|
||||
|
@ -16,7 +16,6 @@ Vue.filter("roundBadgeNumber", roundBadgeNumber);
|
||||
const vueApp = new Vue({
|
||||
el: "#viewport",
|
||||
data: {
|
||||
activeWindow: null,
|
||||
activeChannel: null,
|
||||
appName: document.title,
|
||||
currentUserVisibleError: null,
|
||||
|
Loading…
Reference in New Issue
Block a user