1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { RootState } from '~/store/store';
6 import { compose } from 'redux';
7 import { reduxForm, isPristine, isValid } from 'redux-form';
8 import { connect } from 'react-redux';
9 import { saveEditedUser } from '~/store/my-account/my-account-panel-actions';
10 import { MyAccountPanelRoot, MyAccountPanelRootDataProps } from '~/views/my-account-panel/my-account-panel-root';
11 import { MY_ACCOUNT_FORM } from "~/store/my-account/my-account-panel-actions";
13 const mapStateToProps = (state: RootState): MyAccountPanelRootDataProps => ({
14 isPristine: isPristine(MY_ACCOUNT_FORM)(state),
15 isValid: isValid(MY_ACCOUNT_FORM)(state),
16 initialValues: state.auth.user
19 export const MyAccountPanel = compose(
20 connect(mapStateToProps),
22 form: MY_ACCOUNT_FORM,
23 onSubmit: (data, dispatch) => {
24 dispatch(saveEditedUser(data));
26 }))(MyAccountPanelRoot);