I am facing an issue in my application where I need to pass the Email value from the login component to the dashboard component. Both components are separate entities.
In the login component, I have saved the values in local storage using setItem as shown below:
login.component.ts
//somecode
if (loggedIn) {
localStorage.setItem(LocalStorageKey.KEY_CoachGender, this.coachProfile.CoachGender);
localStorage.setItem(LocalStorageKey.KEY_Email, this.coachProfile.Email);
}
And in the Dashboard component:
let EmailId = localStorage.getItem(LocalStorageKey.KEY_Email);
this.hubConnection.invoke("Register", EmailId)
console.log("Connected")
console.log(EmailId)
However, when trying to retrieve the EmailId from local storage, it returns a null value in the console. Can someone assist me in resolving this issue and successfully retrieving the value without encountering null?