Fix: When frontend cannot renew token, log out the user

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2024-07-03 12:26:47 +02:00
parent ed6cff0535
commit 3ed9d41fe8
Signed by: luzifer
SSH key fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E

View file

@ -122,6 +122,11 @@ const app = createApp({
fetch('config-editor/refreshToken', this.$root.fetchOpts) fetch('config-editor/refreshToken', this.$root.fetchOpts)
.then((resp: Response) => this.$root.parseResponseFromJSON(resp)) .then((resp: Response) => this.$root.parseResponseFromJSON(resp))
.then((data: any) => this.login(data.token, new Date(data.expiresAt), data.user)) .then((data: any) => this.login(data.token, new Date(data.expiresAt), data.user))
.catch(err => {
// Being unable to renew a token is a reason to logout
this.logout()
throw err
})
}, },
unregisterTicker(id: string): void { unregisterTicker(id: string): void {