Skip to content
Snippets Groups Projects
Commit 1383328e authored by Thomas Hackl's avatar Thomas Hackl
Browse files

Resolve "Courseware: Abruf des Zertifikats, obwohl das für die Unit gar nicht aktiviert ist"

Closes #3548

Merge request studip/studip!2524
parent dd936177
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@ class Unit extends SchemaProvider
'public' => (int) $resource['public'],
'release-date' => $resource['release_date'] ? date('c', $resource['release_date']) : null,
'withdraw-date' => $resource['withdraw_date'] ? date('c', $resource['withdraw_date']) : null,
'config' => json_decode($resource['config']),
'mkdate' => date('c', $resource['mkdate']),
'chdate' => date('c', $resource['chdate']),
];
......
......@@ -286,13 +286,14 @@ export default {
createFeedback: 'feedback-elements/create',
loadFeedbackElement: 'feedback-elements/loadById',
}),
async checkCertificate() {
if (this.getStudipConfig('COURSEWARE_CERTIFICATES_ENABLE')) {
const response = await axios.get(STUDIP.URLHelper.getURL('jsonapi.php/v1/courseware-units/' +
this.unit.id + '/certificate/' + STUDIP.USER_ID));
if (response.status === 200) {
this.certificate = response.data;
}
checkCertificate() {
if (this.getStudipConfig('COURSEWARE_CERTIFICATES_ENABLE') && this.unit.attributes.config.certificate) {
axios.get(STUDIP.URLHelper.getURL('jsonapi.php/v1/courseware-units/' +
this.unit.id + '/certificate/' + STUDIP.USER_ID))
.then(response => {
this.certificate = response.data;
})
.catch(error => {});
}
},
executeDelete() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment