|
|
|
@ -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,17 +40,8 @@ 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) { |
|
|
|
@ -89,6 +80,11 @@ class Account extends React.Component {
|
|
|
|
|
accountView = this.renderAccountView(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var accountList = <li>No account yet</li> |
|
|
|
|
if (this.state.accounts != null) { |
|
|
|
|
accountList = this.state.accounts.map(this.renderAccounts) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.props.params.accountId) { |
|
|
|
|
return ( |
|
|
|
|
<div className="grid-block"> |
|
|
|
@ -104,7 +100,7 @@ class Account extends React.Component {
|
|
|
|
|
<div className="grid-block"> |
|
|
|
|
<div className="large-4 medium-4 small-12"> |
|
|
|
|
<ul> |
|
|
|
|
{this.state.accounts.map(this.renderAccounts)} |
|
|
|
|
{accountList} |
|
|
|
|
</ul> |
|
|
|
|
</div> |
|
|
|
|
<div className="large-6 medium-6 small-12"> |
|
|
|
|