Files
planka-zh/client/src/containers/LoginContainer.js
2023-10-17 19:18:19 +02:00

37 lines
893 B
JavaScript
Executable File

import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import Login from '../components/Login';
const mapStateToProps = (state) => {
const oidcConfig = selectors.selectOidcConfig(state);
const {
ui: {
authenticateForm: { data: defaultData, isSubmitting, isSubmittingWithOidc, error },
},
} = state;
return {
defaultData,
isSubmitting,
isSubmittingWithOidc,
error,
withOidc: !!oidcConfig,
};
};
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onAuthenticate: entryActions.authenticate,
onAuthenticateWithOidc: entryActions.authenticateWithOidc,
onMessageDismiss: entryActions.clearAuthenticateError,
},
dispatch,
);
export default connect(mapStateToProps, mapDispatchToProps)(Login);