Protecting routes on hte FE and improving authentication

This commit is contained in:
2024-08-20 21:45:13 +02:00
parent 2f7300db0f
commit a6d54242bb
14 changed files with 98 additions and 12 deletions

View File

@ -14,6 +14,6 @@ document.addEventListener("DOMContentLoaded", function () {
function logout() {
localStorage.removeItem("token");
localStorage.removeItem("token_expiry");
location.href = "/login";
location.href = "/logout";
}

View File

@ -36,7 +36,8 @@ export function val(api) {
localStorage.setItem("token", response.authentication_token.token);
localStorage.setItem("token_expiry", response.authentication_token.expiry);
showSuccess("login-messages", "Login successful.")
location.href = "/";
// location.href = "/";
document.getElementById("login-form").submit()
} else {
showError("login-messages", response.message)
}