|
|
@ -23,11 +23,11 @@ class Account extends React.Component { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() { |
|
|
|
componentDidMount() { |
|
|
|
if (this.state.accounts.length < 1) { |
|
|
|
AccountStore.addChangeListener(this._onChange); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.state.accounts == null || this.state.accounts.length < 1) { |
|
|
|
this.fetchAllAccounts(); |
|
|
|
this.fetchAllAccounts(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AccountStore.addChangeListener(this._onChange); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() { |
|
|
|
componentWillUnmount() { |
|
|
@ -40,17 +40,8 @@ class Account extends React.Component { |
|
|
|
|
|
|
|
|
|
|
|
getAccountState() { |
|
|
|
getAccountState() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
accounts: this.getAllAccountsState(), |
|
|
|
accounts: AccountStore.accounts |
|
|
|
account: this.getOneAccountsState() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getAllAccountsState() { |
|
|
|
|
|
|
|
return AccountStore.accounts |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getOneAccountsState() { |
|
|
|
|
|
|
|
return AccountStore.account |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderAccounts(act, index) { |
|
|
|
renderAccounts(act, index) { |
|
|
@ -89,6 +80,11 @@ class Account extends React.Component { |
|
|
|
accountView = this.renderAccountView(); |
|
|
|
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) { |
|
|
|
if (this.props.params.accountId) { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className="grid-block"> |
|
|
|
<div className="grid-block"> |
|
|
@ -104,7 +100,7 @@ class Account extends React.Component { |
|
|
|
<div className="grid-block"> |
|
|
|
<div className="grid-block"> |
|
|
|
<div className="large-4 medium-4 small-12"> |
|
|
|
<div className="large-4 medium-4 small-12"> |
|
|
|
<ul> |
|
|
|
<ul> |
|
|
|
{this.state.accounts.map(this.renderAccounts)} |
|
|
|
{accountList} |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="large-6 medium-6 small-12"> |
|
|
|
<div className="large-6 medium-6 small-12"> |
|
|
|