}
};
-export const saveAccountLinkData = (t: LinkAccountType) =>
+export const startLinking = (t: LinkAccountType) =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
const accountToLink = {type: t, userUuid: services.authService.getUuid(), token: services.authService.getApiToken()} as AccountToLink;
services.linkAccountService.saveToSession(accountToLink);
import * as React from 'react';
import { Dispatch } from 'redux';
import { connect } from 'react-redux';
-import { saveAccountLinkData } from '~/store/link-account-panel/link-account-panel-actions';
+import { startLinking } from '~/store/link-account-panel/link-account-panel-actions';
import { Grid, Typography, Button } from '@material-ui/core';
import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
import { ArvadosTheme } from '~/common/custom-theme';
});
export interface InactivePanelActionProps {
- linkAccount: () => void;
+ startLinking: () => void;
}
const mapDispatchToProps = (dispatch: Dispatch): InactivePanelActionProps => ({
- linkAccount: () => dispatch<any>(saveAccountLinkData(LinkAccountType.ACCESS_OTHER_ACCOUNT))
+ startLinking: () => dispatch<any>(startLinking(LinkAccountType.ACCESS_OTHER_ACCOUNT))
});
type InactivePanelProps = WithStyles<CssRules> & InactivePanelActionProps;
-export const InactivePanel = connect(null, mapDispatchToProps)(withStyles(styles)((({ classes, linkAccount }: InactivePanelProps) =>
+export const InactivePanel = connect(null, mapDispatchToProps)(withStyles(styles)((({ classes, startLinking }: InactivePanelProps) =>
<Grid container justify="center" alignItems="center" direction="column" spacing={24}
className={classes.root}
style={{ marginTop: 56, height: "100%" }}>
</Typography>
</Grid>
<Grid item>
- <Button className={classes.ontop} color="primary" variant="contained" onClick={() => linkAccount()}>
+ <Button className={classes.ontop} color="primary" variant="contained" onClick={() => startLinking()}>
Link Account
</Button>
</Grid>
}
export interface LinkAccountPanelRootActionProps {
- saveAccountLinkData: (type: LinkAccountType) => void;
+ startLinking: (type: LinkAccountType) => void;
cancelLinking: () => void;
linkAccount: () => void;
}
type LinkAccountPanelRootProps = LinkAccountPanelRootDataProps & LinkAccountPanelRootActionProps & WithStyles<CssRules>;
export const LinkAccountPanelRoot = withStyles(styles) (
- ({classes, targetUser, userToLink, status, error, saveAccountLinkData, cancelLinking, linkAccount}: LinkAccountPanelRootProps) => {
+ ({classes, targetUser, userToLink, status, error, startLinking, cancelLinking, linkAccount}: LinkAccountPanelRootProps) => {
return <Card className={classes.root}>
<CardContent>
{ status === LinkAccountPanelStatus.INITIAL && targetUser &&
</Grid>
<Grid container item direction="row" spacing={24}>
<Grid item>
- <Button color="primary" variant="contained" onClick={() => saveAccountLinkData(LinkAccountType.ADD_OTHER_LOGIN)}>
+ <Button color="primary" variant="contained" onClick={() => startLinking(LinkAccountType.ADD_OTHER_LOGIN)}>
Add another login to this account
</Button>
</Grid>
<Grid item>
- <Button color="primary" variant="contained" onClick={() => saveAccountLinkData(LinkAccountType.ACCESS_OTHER_ACCOUNT)}>
+ <Button color="primary" variant="contained" onClick={() => startLinking(LinkAccountType.ACCESS_OTHER_ACCOUNT)}>
Use this login to access another account
</Button>
</Grid>
import { RootState } from '~/store/store';
import { Dispatch } from 'redux';
import { connect } from 'react-redux';
-import { saveAccountLinkData, cancelLinking, linkAccount } from '~/store/link-account-panel/link-account-panel-actions';
+import { startLinking, cancelLinking, linkAccount } from '~/store/link-account-panel/link-account-panel-actions';
import { LinkAccountType } from '~/models/link-account';
import {
LinkAccountPanelRoot,
};
const mapDispatchToProps = (dispatch: Dispatch): LinkAccountPanelRootActionProps => ({
- saveAccountLinkData: (type: LinkAccountType) => dispatch<any>(saveAccountLinkData(type)),
+ startLinking: (type: LinkAccountType) => dispatch<any>(startLinking(type)),
cancelLinking: () => dispatch<any>(cancelLinking()),
linkAccount: () => dispatch<any>(linkAccount())
});