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,
17 localCluster: state.auth.localCluster
20 export const MyAccountPanel = compose(
21 connect(mapStateToProps),
23 form: MY_ACCOUNT_FORM,
24 onSubmit: (data, dispatch) => {
25 dispatch(saveEditedUser(data));
27 }))(MyAccountPanelRoot);