try preventDefault

This commit is contained in:
Arthur Lu 2022-12-12 15:11:52 -08:00
parent 3abd62773d
commit 87806a9aaa

View File

@ -4,10 +4,7 @@ window.addEventListener("DOMContentLoaded", init);
function init (){
let formSubmitButton = document.querySelector("#submit");
formSubmitButton.addEventListener("click", loginFormSubmitHandler(e));
}
async function loginFormSubmitHandler (e) {
formSubmitButton.addEventListener("click", async (e) => {
e.preventDefault();
let form = document.querySelector("form");
let formData = new FormData(form);
@ -19,4 +16,5 @@ async function loginFormSubmitHandler (e) {
catch (error) {
console.log(error);
}
});
}