diff --git a/src/actions/terms.js b/src/actions/terms.js index 599a9c79..bc0a1907 100644 --- a/src/actions/terms.js +++ b/src/actions/terms.js @@ -123,14 +123,14 @@ function checkStatusDone(entity, tokens) { * @return {Promise} resolves to the list of term objects */ const checkStatus = maxAttempts => getTermsDone(entity, tokens, mockAgreed).then((res) => { - const allAgreed = _.every(res, 'agreed'); + const allAgreed = _.every(res.terms, 'agreed'); // if not all terms are agreed and we still have some attempts to try if (!allAgreed && maxAttempts > 1) { return delay(TIME_OUT).then(() => checkStatus(maxAttempts - 1)); } - return res; + return res.terms; }); return checkStatus(MAX_ATTEMPTS); diff --git a/src/services/terms.js b/src/services/terms.js index a6914bbc..224f825a 100644 --- a/src/services/terms.js +++ b/src/services/terms.js @@ -68,9 +68,7 @@ class TermsService { } return []; - }).then(terms => ({ - terms, - })); + }).then(terms => terms); } /** @@ -93,7 +91,7 @@ class TermsService { return this.getTermDetails(term.id).then(res => _.pick(res, ['id', 'agreed', 'title'])); }); - return Promise.all(promises).then(terms => ({ terms })); + return Promise.all(promises).then(terms => terms); } /**