I'm storing session information in sessionStorage. Currently, when a user opens the application and if sessionStorage is null, the session logs out. However, I want the session to log out automatically when the browser or tab is closed, but not when the user navigates to other links.
To summarize, I want to disable the jwt that we keep in the backend by sending a request to the logout endpoint when the tab is closed.
I tried with "beforeunload" function but it doesnt work for me