From 4c99bbb58abce474a25d25d46459cfef59ed0ef0 Mon Sep 17 00:00:00 2001 From: DocuSeal Date: Wed, 25 Oct 2023 02:06:47 +0300 Subject: [PATCH] add onComplete form callback --- app/javascript/submission_form/form.vue | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/javascript/submission_form/form.vue b/app/javascript/submission_form/form.vue index f4ed999e..9873c3df 100644 --- a/app/javascript/submission_form/form.vue +++ b/app/javascript/submission_form/form.vue @@ -392,6 +392,13 @@ export default { required: false, default: () => [] }, + onComplete: { + type: Function, + required: false, + default () { + return () => {} + } + }, withConfetti: { type: Boolean, required: false, @@ -696,6 +703,12 @@ export default { } } else { this.isCompleted = true + + const respData = await response.text() + + if (respData) { + this.onComplete(JSON.parse(respData)) + } } }).catch(error => { console.error('Error submitting form:', error)