add submitter completed redirect url

This commit is contained in:
Pete Matsyburka
2024-01-14 12:11:13 +02:00
parent 2edc76414b
commit d0ba180729
9 changed files with 54 additions and 7 deletions
+1
View File
@@ -19,6 +19,7 @@ window.customElements.define('submission-form', class extends HTMLElement {
withTypedSignature: this.dataset.withTypedSignature !== 'false',
values: reactive(JSON.parse(this.dataset.values)),
completedButton: JSON.parse(this.dataset.completedButton),
completedRedirectUrl: this.dataset.completedRedirectUrl,
attachments: reactive(JSON.parse(this.dataset.attachments)),
fields: JSON.parse(this.dataset.fields)
})
+12 -3
View File
@@ -332,9 +332,9 @@
v-else
:is-demo="isDemo"
:attribution="attribution"
:completed-button="completedButton"
:with-send-copy-button="withSendCopyButton"
:with-download-button="withDownloadButton"
:completed-button="completedRedirectUrl ? {} : completedButton"
:with-send-copy-button="withSendCopyButton && !completedRedirectUrl"
:with-download-button="withDownloadButton && !completedRedirectUrl"
:with-confetti="withConfetti"
:can-send-email="canSendEmail && !!submitter.email"
:submitter-slug="submitterSlug"
@@ -496,6 +496,11 @@ export default {
required: false,
default: true
},
completedRedirectUrl: {
type: String,
required: false,
default: ''
},
completedButton: {
type: Object,
required: false,
@@ -784,6 +789,10 @@ export default {
if (respData) {
this.onComplete(JSON.parse(respData))
}
if (this.completedRedirectUrl) {
window.location.href = this.completedRedirectUrl
}
}
}).catch(error => {
console.error(error)