isLogin = false;
isLogged = new Subject<boolean>();
constructor(private _httlpClient: HttpClient) {}
login(credential: any): any {
this.isLogin = false;
if (credential != '') {
this.isLogin = true;
}
this.isLogged.next(this.isLogin);
return this._httlpClient.post(this.url, credential);
}
<!--This is the function where i need to retain data-->
setSession(token: string) {
localStorage.setItem('authToken', token);
}
getSession() {
return localStorage.getItem('authToken');
}
}
after i logged in the profile page should be remained displayed until i logout, but when i refresh the page the profile page is already missing.