This commit is contained in:
seb
2026-07-31 07:02:51 +02:00
parent 9dac151854
commit a95b7f4b1e
14 changed files with 1064 additions and 831 deletions

View File

@@ -0,0 +1,30 @@
import { Component } from 'react';
import { connect } from 'react-redux';
import { enqueueSnackbar } from 'notistack';
import { bootstrapSession } from '../store/authSlice';
class AuthBootstrap extends Component {
componentDidMount() {
this.props
.bootstrapSession()
.unwrap()
.then((session) => {
if (session.forbidden) {
enqueueSnackbar(session.message, { variant: 'warning' });
}
})
.catch((err) => {
enqueueSnackbar(`Session check failed: ${err.message}`, { variant: 'error' });
});
}
render() {
return this.props.children;
}
}
const mapDispatchToProps = (dispatch) => ({
bootstrapSession: () => dispatch(bootstrapSession()),
});
export default connect(null, mapDispatchToProps)(AuthBootstrap);