Fix questions & submissions assignment

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2020-06-22 15:41:00 +02:00
parent 31cd45d582
commit 565f3d1fb4
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF

View file

@ -172,17 +172,19 @@ export default {
async loadFormResults() { async loadFormResults() {
this.loadingResults = true this.loadingResults = true
console.debug('Loading Results') console.debug('Loading results for form', this.form.hash)
try { try {
const response = await axios.get(generateUrl('/apps/forms/api/v1/submissions/{hash}', { const response = await axios.get(generateUrl('/apps/forms/api/v1/submissions/{hash}', {
hash: this.form.hash, hash: this.form.hash,
})) }))
this.form.submissions = response.data.submissions
this.form.questions = response.data.questions // Append questions & submissions
this.$set(this.form, 'submissions', response.data.submissions)
this.$set(this.form, 'questions', response.data.questions)
} catch (error) { } catch (error) {
console.error(error) console.error(error)
showError(t('forms', 'There was an error while loading results')) showError(t('forms', 'There was an error while loading the results'))
} finally { } finally {
this.loadingResults = false this.loadingResults = false
} }