Skip to content

Commit

Permalink
Extract function
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Oct 21, 2023
1 parent 25e96dd commit b9d4f41
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/realtime-compiler/resources/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@
* Progressive enhancement when JavaScript is enabled to intercept form requests
* and instead handle them with an asynchronous Fetch instead of refreshing the page.
*/
const forms = document.querySelectorAll(".openInEditorForm");
forms.forEach(form => {
function registerAsyncForm(form) {
form.addEventListener("submit", function (event) {
// Disable default form submit
event.preventDefault();
Expand All @@ -305,6 +305,10 @@
console.error("Network error:", error);
});
});
}
document.querySelectorAll(".openInEditorForm").forEach(form => {
registerAsyncForm(form);
});
</script>
@endif
Expand Down

0 comments on commit b9d4f41

Please sign in to comment.