mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
27 lines
950 B
TypeScript
27 lines
950 B
TypeScript
import { connect } from 'react-redux';
|
|
import { RootState } from '../../../reducers';
|
|
import { Dispatch } from 'redux';
|
|
import { push } from 'connected-react-router';
|
|
import * as AutheliaService from '../../../services/AutheliaService';
|
|
import ResetPasswordView, { StateProps } from '../../../views/ResetPasswordView/ResetPasswordView';
|
|
|
|
const mapStateToProps = (state: RootState): StateProps => ({
|
|
disabled: state.resetPassword.loading,
|
|
});
|
|
|
|
const mapDispatchToProps = (dispatch: Dispatch) => {
|
|
return {
|
|
onInit: async (token: string) => {
|
|
await AutheliaService.completePasswordResetIdentityValidation(token);
|
|
},
|
|
onPasswordResetRequested: async (newPassword: string) => {
|
|
await AutheliaService.resetPassword(newPassword);
|
|
await dispatch(push('/'));
|
|
},
|
|
onCancelClicked: async () => {
|
|
await dispatch(push('/'));
|
|
}
|
|
}
|
|
}
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ResetPasswordView); |