diff --git a/public/env.sample.js b/public/env.sample.js index 8fcafee..1da07d7 100644 --- a/public/env.sample.js +++ b/public/env.sample.js @@ -4,7 +4,7 @@ const config = { // required, with trailing slash baseurl: '', // full url (including fqdn) - baseurl_documentserver: 'http://localhost:4010/documents', + baseurl_documentserver: 'http://localhost:3000', // optional, will fallback to code128 code_format: 'ean13', // optional, will fallback to /imprint diff --git a/src/views/Profile.vue b/src/views/Profile.vue index 1863922..3952c1d 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -589,12 +589,36 @@ function get_certificate() { (navigator.languages && navigator.languages[0]) || "" ).substr(0, 2); - let url = `${config.baseurl_documentserver}certificates?locale=${browserlocale}&download=true&key=${config.documentserver_key}`; - let postdata = Object.assign({}, state.fullobject); - postdata.group = { - name: postdata.group, + let url = `${config.baseurl_documentserver}/v1/pdfs/certificates?key=${config.documentserver_key}`; + let postdata = { + locale: browserlocale, + runners: [ + { + first_name: state.firstname, + middle_name: state.middlename, + last_name: state.lastname, + id: state.fullobject.id, + distance: state.fullobject.distance, + group: { + name: state.group, + id: state.fullobject.group.id || 0, + }, + distance_donations: state.fullobject.distanceDonations.map((s) => { + return { + id: s.id || 0, + amount: s.amount, + amount_per_distance: s.amountPerDistance, + donor: { + id: s.donor.id || 0, + first_name: s.donor.firstname, + middle_name: s.donor.middlename, + last_name: s.donor.lastname, + }, + }; + }), + } + ] }; - postdata = [postdata]; axios .post(url, postdata, { responseType: "blob",