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 (