Skip to content

Issue-4562 - Terms - Fix return data #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/actions/terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 2 additions & 4 deletions src/services/terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ class TermsService {
}

return [];
}).then(terms => ({
terms,
}));
}).then(terms => terms);
}

/**
Expand All @@ -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);
}

/**
Expand Down