|
|
@@ -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() { |
|
|
|