mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-07-09 13:27:45 +00:00
fix(DevWeb): Remove endpoint link for login
This commit is contained in:
@@ -7,10 +7,9 @@ loginForm.addEventListener("submit", (event) => {
|
|||||||
formData.forEach((value, key) => data[key] = value);
|
formData.forEach((value, key) => data[key] = value);
|
||||||
|
|
||||||
const action = loginForm.getAttribute("action")
|
const action = loginForm.getAttribute("action")
|
||||||
const endpoint = loginForm.getAttribute("data-login-endpoint");
|
|
||||||
const method = loginForm.getAttribute("method")
|
const method = loginForm.getAttribute("method")
|
||||||
|
|
||||||
fetch(endpoint, {
|
fetch(action, {
|
||||||
headers: {"Content-Type": "application/json"},
|
headers: {"Content-Type": "application/json"},
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
method,
|
method,
|
||||||
@@ -18,7 +17,7 @@ loginForm.addEventListener("submit", (event) => {
|
|||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
if (data.status == 200) window.location.href = action;
|
if (data.status === 200 && data.nextUrl) window.location.href = data.nextUrl;
|
||||||
})
|
})
|
||||||
.catch(error => console.error("Error:", error))
|
.catch(error => console.error("Error:", error))
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user