Logout Icon
This icon will navigate us to the login page.

Upon selecting the logout option, the system redirects users to the login page and clears the local storage as a security measure.

Logout Code Snippet
function logout() {
localStorage.clear(); // Clear local storage
window.location.href = '/auth/login/login.html'; // Redirect to login page
}
Code description
The logout function performs the following actions:
Clear Local Storage
Invokes localStorage.clear() to remove all key-value pairs stored in the local storage. This typically includes user-related data, tokens, or any other information stored during the user's session.
Redirect to Login Page
Uses window.location.href to redirect the user to the login page ('/auth/login/login.html'). After clearing local storage, redirecting to the login page ensures that the user is logged out and can initiate a new login session.
Last updated