add sample terms response

This commit is contained in:
David Baker 2019-07-10 14:25:30 +01:00
parent f7750d9df0
commit 6fafd208a8

View file

@ -64,6 +64,25 @@ export async function startTermsFlow(services, interactionCallback) {
(s) => MatrixClientPeg.get().getTerms(s.serviceType, s.baseUrl, s.accessToken), (s) => MatrixClientPeg.get().getTerms(s.serviceType, s.baseUrl, s.accessToken),
); );
/*
* a /terms response looks like:
* {
* "policies": {
* "terms_of_service": {
* "version": "2.0",
* "en": {
* "name": "Terms of Service",
* "url": "https://example.org/somewhere/terms-2.0-en.html"
* },
* "fr": {
* "name": "Conditions d'utilisation",
* "url": "https://example.org/somewhere/terms-2.0-fr.html"
* }
* }
* }
* }
*/
const terms = await Promise.all(termsPromises); const terms = await Promise.all(termsPromises);
const policiesAndServicePairs = terms.map((t, i) => { return { 'service': services[i], 'policies': t.policies }; }); const policiesAndServicePairs = terms.map((t, i) => { return { 'service': services[i], 'policies': t.policies }; });