mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-07-09 21:37:46 +00:00
draft(DevWeb): Try to resolve redirection
This commit is contained in:
@@ -8,12 +8,16 @@ loginForm.addEventListener("submit", (event) => {
|
|||||||
formData.forEach((value, key) => data[key] = value);
|
formData.forEach((value, key) => data[key] = value);
|
||||||
|
|
||||||
fetch(loginForm.getAttribute("action"), {
|
fetch(loginForm.getAttribute("action"), {
|
||||||
headers: {"Content-Type": "application/json"},
|
headers: {"Content-Type": "application/json"}, body: JSON.stringify(data), method: loginForm.getAttribute("method"),
|
||||||
body: JSON.stringify(data),
|
})
|
||||||
method: loginForm.getAttribute("method"),
|
.then(res => {
|
||||||
|
if (res.ok) {
|
||||||
|
window.location.href = "./main-menu";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// TODO Display red inputs
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.then(res => res.json())
|
|
||||||
.then(d => window.location.href = "./main-menu")
|
|
||||||
.catch(error => console.error("Error:", error));
|
.catch(error => console.error("Error:", error));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user