1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { RootState } from '~/store/store';
6 import { Dispatch } from 'redux';
7 import { connect } from 'react-redux';
8 import { startLinking, cancelLinking, linkAccount } from '~/store/link-account-panel/link-account-panel-actions';
9 import { LinkAccountType } from '~/models/link-account';
12 LinkAccountPanelRootDataProps,
13 LinkAccountPanelRootActionProps
14 } from '~/views/link-account-panel/link-account-panel-root';
16 const mapStateToProps = (state: RootState): LinkAccountPanelRootDataProps => {
18 targetUser: state.linkAccountPanel.targetUser,
19 userToLink: state.linkAccountPanel.userToLink,
20 status: state.linkAccountPanel.status,
21 error: state.linkAccountPanel.error
25 const mapDispatchToProps = (dispatch: Dispatch): LinkAccountPanelRootActionProps => ({
26 startLinking: (type: LinkAccountType) => dispatch<any>(startLinking(type)),
27 cancelLinking: () => dispatch<any>(cancelLinking()),
28 linkAccount: () => dispatch<any>(linkAccount())
31 export const LinkAccountPanel = connect(mapStateToProps, mapDispatchToProps)(LinkAccountPanelRoot);