summaryrefslogtreecommitdiff
path: root/ui/app/components/main_panel/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/main_panel/index.js')
-rw-r--r--ui/app/components/main_panel/index.js25
1 files changed, 19 insertions, 6 deletions
diff --git a/ui/app/components/main_panel/index.js b/ui/app/components/main_panel/index.js
index 775dff61..19485358 100644
--- a/ui/app/components/main_panel/index.js
+++ b/ui/app/components/main_panel/index.js
@@ -28,6 +28,7 @@ export default class MainPanel extends React.Component {
accounts: []
}
this.activateAccount = this.activateAccount.bind(this)
+ this.removeAccount = this.removeAccount.bind(this)
}
componentWillMount() {
@@ -46,11 +47,20 @@ export default class MainPanel extends React.Component {
})
}
- //setAccounts(accounts) {
- // this.setState({
- // accounts: accounts
- // })
- //}
+ removeAccount(account) {
+ Account.remove(account).then(
+ newActiveAccount => {
+ console.log(newActiveAccount)
+ this.setState({
+ account: newActiveAccount,
+ accounts: Account.list
+ })
+ },
+ error => {
+ console.log(error)
+ }
+ )
+ }
render() {
let emailSection = null
@@ -64,7 +74,10 @@ export default class MainPanel extends React.Component {
return (
<div className="main-panel">
- <AccountList account={this.state.account} accounts={this.state.accounts} onSelect={this.activateAccount} />
+ <AccountList account={this.state.account}
+ accounts={this.state.accounts}
+ onSelect={this.activateAccount}
+ onRemove={this.removeAccount}/>
<div className="body">
<UserSection account={this.state.account} onLogin={this.activateAccount} onLogout={this.activateAccount}/>
{vpnSection}