Protecting routes on hte FE and improving authentication
This commit is contained in:
		@ -14,6 +14,6 @@ document.addEventListener("DOMContentLoaded", function () {
 | 
			
		||||
function logout() {
 | 
			
		||||
    localStorage.removeItem("token");
 | 
			
		||||
    localStorage.removeItem("token_expiry");
 | 
			
		||||
    location.href = "/login";
 | 
			
		||||
    location.href = "/logout";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user