Merge branch 'master' into 14644-nanh-nanm-in-subprocess-view
[arvados.git] / src / views / my-account-panel / my-account-panel.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
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";
12
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
17 });
18
19 export const MyAccountPanel = compose(
20     connect(mapStateToProps),
21     reduxForm({
22     form: MY_ACCOUNT_FORM,
23     onSubmit: (data, dispatch) => {
24         dispatch(saveEditedUser(data));
25     }
26 }))(MyAccountPanelRoot);