Enhance Form Submission Export Functionality (#657)
* Enhance Form Submission Export Functionality * Validate new param 'columns' * Form submission export request as seprate class with validation * Test case for export --------- Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
@@ -213,7 +213,7 @@ export default {
|
||||
if (!this.form) {
|
||||
return ''
|
||||
}
|
||||
return this.runtimeConfig.public.apiBase + '/open/forms/' + this.form.id + '/submissions/export'
|
||||
return this.runtimeConfig.public.apiBase + 'open/forms/' + this.form.id + '/submissions/export'
|
||||
},
|
||||
isLoading() {
|
||||
return this.recordStore.loading
|
||||
@@ -333,8 +333,13 @@ export default {
|
||||
return
|
||||
}
|
||||
this.exportLoading = true
|
||||
opnFetch(this.exportUrl, {responseType: "blob"})
|
||||
.then(blob => {
|
||||
opnFetch(this.exportUrl, {
|
||||
responseType: "blob",
|
||||
method: "POST",
|
||||
body: {
|
||||
columns: this.displayColumns
|
||||
}
|
||||
}).then(blob => {
|
||||
const filename = `${this.form.slug}-${Date.now()}-submissions.csv`
|
||||
const a = document.createElement("a")
|
||||
document.body.appendChild(a)
|
||||
|
||||
Reference in New Issue
Block a user