import React from 'react'; import { FormattedMessage as Message } from 'react-intl'; import { connect } from 'app/functions'; import BaseAuthBody from 'app/components/auth/BaseAuthBody'; import { getSortedAccounts } from 'app/components/accounts/reducer'; import type { Account } from 'app/components/accounts'; import AccountSwitcher from './AccountSwitcher'; import styles from './chooseAccount.scss'; // I can't connect the ChooseAccountBody component with redux's "connect" function // to get accounts list because it will break the TransitionMotion animation implementation. // // So to provide accounts list to the component, I'll create connected version of // the composes with already provided accounts list const ConnectedAccountSwitcher = connect((state) => ({ accounts: getSortedAccounts(state), }))(AccountSwitcher); export default class ChooseAccountBody extends BaseAuthBody { static displayName = 'ChooseAccountBody'; static panelId = 'chooseAccount'; render() { const { client } = this.context.auth; return (
{this.renderErrors()}
{client ? ( {client.name}, }} /> ) : ( )}
); } onSwitch = (account: Account): Promise => { return Promise.resolve(this.context.resolve(account)); }; }