Skip to content

Commit

Permalink
Improve login/logout flow
Browse files Browse the repository at this point in the history
Signed-off-by: Knut Ahlers <knut@ahlers.me>
  • Loading branch information
Luzifer committed Jun 20, 2024
1 parent d10c78a commit b75af63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/_headNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default defineComponent({
data() {
return {
socketConnected: false,
socketConnected: true, // Directly after load it should always be connected
}
},
Expand Down
6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit b75af63

Please sign in to comment.