Skip to content

Commit

Permalink
Fix problem with failed auto-login
Browse files Browse the repository at this point in the history
This caused a failure correctly forwarding the user to the login page
  • Loading branch information
mfechner committed Jan 1, 2025
1 parent 76118a9 commit 23451b9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const urlWithSlash = url.endsWith('/') ? url : url.concat('/');

const prodUrl = urlWithSlash;

const clientJS = () => {
const clientJS = async () => {

if (import.meta.env.MODE === 'production') {
config.set('url', prodUrl);
Expand All @@ -33,8 +33,12 @@ const clientJS = () => {
config.set('register', true);
}

store.dispatch(loadStoredTheme());
store.dispatch(tryAuthenticate());
await store.dispatch(loadStoredTheme());
try {
await store.dispatch(tryAuthenticate());
} catch (e) {
// console.info('Automatic login failed, will forward later to login page.')
}

initAxios();

Expand All @@ -50,4 +54,4 @@ const clientJS = () => {
unregister();
};

clientJS();
clientJS().then();

0 comments on commit 23451b9

Please sign in to comment.