I am in the process of building a website using Angular 5 and Typescript. One important aspect of my implementation is utilizing localStorage to store the JWT Token for user login.
Whenever I click on a link (either Home or any other link), I implement a function similar to this one:
public toHome() {
this.router.navigate(['']);
}
However, after clicking on the link, both my localStorage and sessionStorage are cleared, resulting in the user being logged out.
If anyone can provide assistance, it would be greatly appreciated. Thank you.