From ed6cff0535c3fad88bec70ad79e800a21da45ed8 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Thu, 20 Jun 2024 17:53:42 +0200 Subject: [PATCH] Improve login/logout flow Signed-off-by: Knut Ahlers --- src/components/_headNav.vue | 2 +- src/main.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/_headNav.vue b/src/components/_headNav.vue index 911f566..6ed1169 100644 --- a/src/components/_headNav.vue +++ b/src/components/_headNav.vue @@ -79,7 +79,7 @@ export default defineComponent({ data() { return { - socketConnected: false, + socketConnected: true, // Directly after load it should always be connected } }, diff --git a/src/main.ts b/src/main.ts index 1b4d153..4f93a17 100644 --- a/src/main.ts +++ b/src/main.ts @@ -31,8 +31,8 @@ const app = createApp({ }, tokenRenewAt(): Date | null { - if (this.tokenExpiresAt === null || this.tokenExpiresAt.getTime() < this.now.getTime()) { - // We don't know when it expires or it's expired, we can't renew + if (this.tokenExpiresAt === null) { + // We don't know when it expires, we can't renew return null } @@ -88,7 +88,7 @@ const app = createApp({ this.tokenUser = username window.localStorage.setItem('twitch-bot-token', JSON.stringify({ expiresAt, token, username })) // Nuke the Twitch auth-response from the browser history - window.history.replaceState(null, '', window.location.href.split('#')[0]) + this.$router.replace({ name: 'dashboard' }) fetch(`config-editor/user?user=${this.tokenUser}`, this.$root.fetchOpts) .then((resp: Response) => this.$root.parseResponseFromJSON(resp))