From 1a9968c1e2592be5baae4bf2c6551ad7f5228f17 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 24 Feb 2017 20:35:24 -0800 Subject: [bug] update UI to use current API --- ui/app/models/account.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'ui/app/models/account.js') diff --git a/ui/app/models/account.js b/ui/app/models/account.js index 0251da03..3656d2c7 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 == '') { - 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 }) -- cgit v1.2.3