/** * Logout functionality. * * This script is responsible for removing the user token from local storage and redirecting to the authentication page upon logout click. */ "use strict"; /** * Add an event listener to the window's load event. * This function will be executed when the document has finished loading. */ window.addEventListener("load", function() { document.getElementById("logout-button").addEventListener("click", logout); }); /** * Removes the user token from local storage and redirects to the authentication page. */ function logout() { window.localStorage.removeItem('token'); window.location.replace("/html/auth.html"); }