diff --git a/components/app.vue b/components/app.vue index b27a7b2..1eb260d 100644 --- a/components/app.vue +++ b/components/app.vue @@ -61,6 +61,7 @@ function getCookie(name) { function refreshToken() { const token = getCookie("skouter") + const timeout = setTimeout(this.refreshToken, 1000*60*25) fetch(`/api/token`, {method: 'GET', @@ -71,13 +72,12 @@ function refreshToken() { }).then(response => { if (!response.ok) { console.log("Error refreshing token.") + clearTimeout(timeout) + window.location.hash = '#login' } else { this.token = getCookie("skouter") } }) - - // Recursive refresh - setTimeout(this.refreshToken, 1000*60*25) } function getUser() {