mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-09-19 18:12:55 +00:00
Improve login/logout flow
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
afb4bf91a2
commit
4d1a4cc936
@ -79,7 +79,7 @@ export default defineComponent({
|
||||
|
||||
data() {
|
||||
return {
|
||||
socketConnected: false,
|
||||
socketConnected: true, // Directly after load it should always be connected
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user