summaryrefslogtreecommitdiff
path: root/ui/app/models
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2017-02-24 20:35:24 -0800
committerelijah <elijah@riseup.net>2017-02-24 20:35:48 -0800
commit1a9968c1e2592be5baae4bf2c6551ad7f5228f17 (patch)
tree6b1c254626e9dc7240858e73f7d9cb2e1232512a /ui/app/models
parent904e99c658e647a1c9acbb80a1f54c593a57bf61 (diff)
[bug] update UI to use current API
Diffstat (limited to 'ui/app/models')
-rw-r--r--ui/app/models/account.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/ui/app/models/account.js b/ui/app/models/account.js
index 0251da0..3656d2c 100644
--- a/ui/app/models/account.js
+++ b/ui/app/models/account.js
@@ -109,19 +109,16 @@ export default class Account {
}
//
- // returns a promise, fullfill is passed account object
+ // returns a list of the authenticated accounts
//
static active() {
- if (!bitmask.api_token()) {
- return new Promise((resolve, reject) => {resolve(null)})
- }
- return bitmask.bonafide.user.active().then(
+ return bitmask.bonafide.user.list().then(
response => {
- if (response.user == '<none>') {
- return null
- } else {
- return new Account(response.user, {authenticated: true})
+ let list = []
+ for (let accountProps of response) {
+ list.push(new Account(accountProps.userid, accountProps))
}
+ return list
}
)
}
@@ -181,7 +178,7 @@ export default class Account {
// this is a temporary hack to support the old behavior
// util the backend has a proper concept of an account list.
//
- static addPrimary(account) {
+ static addActive(account) {
Account.list = Account.list.filter(i => {
return i.domain != account.domain
})