mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-05-16 17:11:48 +00:00
fix(DevWeb): Correct redirection from login
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
const loginForm = document.getElementById("loginForm");
|
||||
const loginForm = document.getElementById("login-form");
|
||||
|
||||
loginForm.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const formData = new FormData(loginForm);
|
||||
const data = {};
|
||||
formData.forEach((value, key) => data[key] = value);
|
||||
@@ -17,7 +18,7 @@ loginForm.addEventListener("submit", (event) => {
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
if (data.status === 200) window.location.href = data.redirect;
|
||||
// if (data.status === 200) window.location.href = data.redirect;
|
||||
})
|
||||
.catch(error => console.error("Error:", error))
|
||||
;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Login</title>
|
||||
<script defer type="text/javascript"><%@include file="../static/js/login.js" %></script>
|
||||
<style><%@include file="../static/css/login.css" %></style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -15,7 +14,7 @@
|
||||
<div class="flex-column login-gap">
|
||||
<div>
|
||||
<h1>Login</h1>
|
||||
<form id="login-form" action="${pageContext.request.contextPath}/login" method="POST">
|
||||
<form id="login-form" action="${pageContext.request.contextPath}/api/auth/login" method="POST">
|
||||
|
||||
<label id="username-label" for="username">Username:</label>
|
||||
<input type="text" id="username" name="username" required>
|
||||
@@ -36,5 +35,7 @@
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<script defer type="text/javascript"><%@include file="../static/js/login.js" %></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user