Replace getActiveWindowComponent with an event
This commit is contained in:
parent
3a6b075745
commit
5a0f1c1f4e
@ -71,7 +71,17 @@ export default {
|
||||
errorShown: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$root.$on("auth:failed", this.onAuthFailed);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$root.$off("auth:failed", this.onAuthFailed);
|
||||
},
|
||||
methods: {
|
||||
onAuthFailed() {
|
||||
this.inFlight = false;
|
||||
this.errorShown = true;
|
||||
},
|
||||
onSubmit(event) {
|
||||
event.preventDefault();
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const socket = require("../socket");
|
||||
const storage = require("../localStorage");
|
||||
const {vueApp, getActiveWindowComponent} = require("../vue");
|
||||
const {vueApp} = require("../vue");
|
||||
const store = require("../store").default;
|
||||
let lastServerHash = null;
|
||||
|
||||
@ -18,12 +18,9 @@ socket.on("auth:failed", function() {
|
||||
return reloadPage("Authentication failed, reloading…");
|
||||
}
|
||||
|
||||
// TODO: This will most likely fail getActiveWindowComponent
|
||||
showSignIn();
|
||||
|
||||
// TODO: getActiveWindowComponent is the SignIn component, find a better way to set this
|
||||
getActiveWindowComponent().errorShown = true;
|
||||
getActiveWindowComponent().inFlight = false;
|
||||
vueApp.$emit("auth:failed");
|
||||
});
|
||||
|
||||
socket.on("auth:start", function(serverHash) {
|
||||
@ -78,7 +75,9 @@ function showSignIn() {
|
||||
window.g_TheLoungeRemoveLoading();
|
||||
}
|
||||
|
||||
vueApp.$router.push("/sign-in");
|
||||
if (vueApp.$route.name !== "SignIn") {
|
||||
vueApp.$router.push("/sign-in");
|
||||
}
|
||||
}
|
||||
|
||||
function reloadPage(message) {
|
||||
|
@ -120,12 +120,7 @@ function initChannel(channel) {
|
||||
}
|
||||
}
|
||||
|
||||
function getActiveWindowComponent() {
|
||||
return vueApp.$refs.app.$refs.window;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
vueApp,
|
||||
initChannel,
|
||||
getActiveWindowComponent,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user