Skip to content

Commit

Permalink
get list of personal boards
Browse files Browse the repository at this point in the history
  • Loading branch information
justincy committed Aug 9, 2017
1 parent 168767c commit f69cebb
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function login(interactive = true) {
if(!loggedIn) {
$('#login').show();
} else {
authenticationSuccess();
begin();
}
}

Expand All @@ -49,7 +49,37 @@ function trelloAuth(interactive = true){
});
}

function authenticationSuccess() {
/**
* Promisify the Trello.rest() method provided by the client.js Trello library
*
* @param {String} method
* @param {String} url
* @param {Object=} params
* @return {Promise} resolves to response object
*/
function trelloRequest(method, url, params = {}) {
return new Promise((resolve, reject) => {
Trello.rest(method, url, params, resolve, reject);
});
}

function begin() {
$('#login').hide();
document.write('<h2>Authenticated</h2>');
chooseBoard();
}

/**
* Choose an existing FamilySearch board or create a new one
*/
async function chooseBoard() {

// Get a list of all personal (non-org boards)
const personalBoards = await trelloRequest('GET', '/members/me/boards', {
filter: 'open'
}).then((boards) => {
return boards.filter(b => b.idOrganization === null);
});

// Is there an existing FamilySearch board?
}

0 comments on commit f69cebb

Please sign in to comment.