diff --git a/index.js b/index.js index 9e463d1..bc5b12d 100644 --- a/index.js +++ b/index.js @@ -22,7 +22,7 @@ async function login(interactive = true) { if(!loggedIn) { $('#login').show(); } else { - authenticationSuccess(); + begin(); } } @@ -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('