fix(ui): Improve token refresh error handling

- Return false instead of throwing error when no refresh token exists
    - Prevent logout on refresh error, just log warning and return false
    - Avoid throwing errors that could break the application flow
master
veypi 2 weeks ago
parent 357827a881
commit a913e7dea2

@ -181,7 +181,7 @@ class VBase {
}
async refresh() {
if (!this.refreshToken) throw new Error("No refresh token");
if (!this.refreshToken) return false;
try {
const data = await this.request('POST', '/api/auth/refresh', { refresh_token: this.refreshToken });
if (data.access_token) {
@ -191,8 +191,8 @@ class VBase {
}
return false;
} catch (e) {
this.logout();
throw e;
console.warn(e)
return false
}
}

Loading…
Cancel
Save