Skip to content

Commit 0450683

Browse files
Terms - Fix return data
1 parent 87e8aad commit 0450683

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/actions/terms.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ function checkStatusDone(entity, tokens) {
123123
* @return {Promise} resolves to the list of term objects
124124
*/
125125
const checkStatus = maxAttempts => getTermsDone(entity, tokens, mockAgreed).then((res) => {
126-
const allAgreed = _.every(res, 'agreed');
126+
const allAgreed = _.every(res.terms, 'agreed');
127127

128128
// if not all terms are agreed and we still have some attempts to try
129129
if (!allAgreed && maxAttempts > 1) {
130130
return delay(TIME_OUT).then(() => checkStatus(maxAttempts - 1));
131131
}
132132

133-
return res;
133+
return res.terms;
134134
});
135135

136136
return checkStatus(MAX_ATTEMPTS);

src/services/terms.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ class TermsService {
6868
}
6969

7070
return [];
71-
}).then(terms => ({
72-
terms,
73-
}));
71+
}).then(terms => terms);
7472
}
7573

7674
/**
@@ -93,7 +91,7 @@ class TermsService {
9391
return this.getTermDetails(term.id).then(res => _.pick(res, ['id', 'agreed', 'title']));
9492
});
9593

96-
return Promise.all(promises).then(terms => ({ terms }));
94+
return Promise.all(promises).then(terms => terms);
9795
}
9896

9997
/**

0 commit comments

Comments
 (0)