u
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user