diff --git a/src/components/Account.js b/src/components/Account.js index abe28f0..59227a7 100644 --- a/src/components/Account.js +++ b/src/components/Account.js @@ -23,11 +23,11 @@ class Account extends React.Component { } componentDidMount() { - if (this.state.accounts.length < 1) { + AccountStore.addChangeListener(this._onChange); + + if (this.state.accounts == null || this.state.accounts.length < 1) { this.fetchAllAccounts(); } - - AccountStore.addChangeListener(this._onChange); } componentWillUnmount() { @@ -40,19 +40,10 @@ class Account extends React.Component { getAccountState() { return { - accounts: this.getAllAccountsState(), - account: this.getOneAccountsState() + accounts: AccountStore.accounts } } - getAllAccountsState() { - return AccountStore.accounts - } - - getOneAccountsState() { - return AccountStore.account - } - renderAccounts(act, index) { return (
  • @@ -89,6 +80,11 @@ class Account extends React.Component { accountView = this.renderAccountView(); } + var accountList =
  • No account yet
  • + if (this.state.accounts != null) { + accountList = this.state.accounts.map(this.renderAccounts) + } + if (this.props.params.accountId) { return (
    @@ -104,7 +100,7 @@ class Account extends React.Component {
      - {this.state.accounts.map(this.renderAccounts)} + {accountList}
    diff --git a/src/components/AuthenticatedApp.js b/src/components/AuthenticatedApp.js index e7cf2c5..8a1458a 100644 --- a/src/components/AuthenticatedApp.js +++ b/src/components/AuthenticatedApp.js @@ -58,7 +58,7 @@ export default class AuthenticatedApp extends React.Component { if (!this.state.userLoggedIn) { return (
    -
    getExpensy
    +
    getExpensy
    Menu Sign Up
    diff --git a/src/components/Tx.js b/src/components/Tx.js index 63914a7..dd99472 100644 --- a/src/components/Tx.js +++ b/src/components/Tx.js @@ -108,16 +108,18 @@ class Tx extends React.Component { } render() { - var txsList = ( -
  • No transaction yet
  • - ); - if (this.state.txs.length) { + var txsList =
  • No transaction yet
  • + if (this.state.txs.length) txsList = this.state.txs.map(this.renderTx); - } + + var act_title = ''; + if (this._account) + act_title = this._account.title; + return (
    -

    {this.props.account.title}

    +

    {act_title}