mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-08 08:10:08 +00:00
Improve login/logout flow
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
cc596b6367
commit
ed6cff0535
2 changed files with 4 additions and 4 deletions
|
@ -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 a new issue