Skip to content

Commit

Permalink
fixing sign in
Browse files Browse the repository at this point in the history
  • Loading branch information
JishnuS420 committed Nov 3, 2023
1 parent a779d45 commit e573e36
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions pages/signin.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ <h2>Sign In</h2>
"Content-Type": "application/json",
},
};
// new code begin
// Fetch JWT
fetch(login_url, authOptions)
.then(response => {
Expand Down Expand Up @@ -139,23 +138,28 @@ <h2>Sign In</h2>
// Fetch the API
fetch(read_url, options)
.then(response => {
if (response.status === 200) {
console.log("Success loser!");
return;
// window.location.href = "https://csa-tri-1.github.io/DADDiJkstra-frontend/pages/app";
} else if (response.status === 401) {
if (response.status === 401) {
alert("Bad password/username input");
console.error("Bad password/username input");
return;
} else if (response.status === 200) {
console.log("Success loser!");
// Only show the alert if the login was successful
alert("Successful Signin!");
// Redirect after alert
window.location.href = "https://csa-tri-1.github.io/DADDiJkstra-frontend/pages/app";
return;
} else {
const errorMsg = 'Database response error: ' + response.status;
alert("Uh oh, something went wrong :(");
console.error(errorMsg);
return;
}
})
.catch(error => {
// Handle network errors or exceptions here
console.error("Network error:", error);
});
})
.catch(error => {
// Handle network errors or exceptions here
console.error("Network error:", error);
});
}

function getEmailFromCookie() {
Expand Down

0 comments on commit e573e36

Please sign in to comment.