This commit is contained in:
seb
2026-10-28 20:12:13 +01:00
parent b13d994058
commit 003b198b86
3 changed files with 113 additions and 38 deletions

View File

@@ -1,7 +1,7 @@
import { Component } from 'react';
import { enqueueSnackbar } from 'notistack';
import { notifyError } from '../utils/notify';
import authAutomat, { bootstrapAuthMe } from '../automats/authAutomat';
import authAutomat, { is502BadGateway } from '../automats/authAutomat';
let sessionBootstrapped = false;
@@ -10,15 +10,16 @@ class AuthBootstrap extends Component {
if (sessionBootstrapped) return;
sessionBootstrapped = true;
bootstrapAuthMe()
authAutomat.actions.bootstrapSession()
.then((session) => {
if (session.forbidden) {
if (session?.forbidden) {
enqueueSnackbar(session.message, { variant: 'warning' });
}
return authAutomat.actions.bootstrapSession(session);
})
.catch((err) => {
notifyError(err);
if (!is502BadGateway(err)) {
notifyError(err);
}
});
}