Skip to content

Commit 53363b6

Browse files
committed
frontend/utils: fix endless spinner in case access token refresh fails.
It would show an endless spinner when the first request for refreshing the access token throws an error. To avoid this we set the app state to logged in when we find the key-material inside the localstorage.
1 parent 17b2cef commit 53363b6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

frontend/src/utils.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,16 @@ export function refresh_access_token() {
124124
refreshPromiseResolved = true;
125125
resolve();
126126
} catch (e) {
127+
128+
//This means we are logged in but the refresh failed
129+
if (localStorage.getItem("loginSalt") && localStorage.getItem("secretKey")) {
130+
loggedIn.value = AppState.LoggedIn;
131+
} else {
132+
logout(false);
133+
}
127134
console.error(e);
128135
refreshPromiseResolved = true;
129-
reject();
136+
resolve();
130137
}
131138
});
132139
return refreshPromise

0 commit comments

Comments
 (0)