Add submission response to event details in tinyforms.js
This makes the submitted data more easily accessible
This commit is contained in:
1 parent
6e3e3ff8f6
commit
dfa621d0bc
2 files changed
+3
-3
No files matched your search
@@ -38,10 +38,10 @@ window.tinyforms = {
|
||||
e.preventDefault();
|
||||
return tinyforms.submitForm(this)
|
||||
.then((response) => {
|
||||
this.dispatchEvent(new CustomEvent('tinyforms:submitted', {detail: { response: response }}));
|
||||
this.dispatchEvent(new CustomEvent('tinyforms:submitted', {detail: { submission: response.submission, response: response }}));
|
||||
})
|
||||
.catch((response) => {
|
||||
this.dispatchEvent(new CustomEvent('tinyforms:error', {detail: { response: response }}));
|
||||
this.dispatchEvent(new CustomEvent('tinyforms:error', {detail: { submission: response.submission, response: response }}));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user