The user logs in, their login info is set to local storage and they are forwarded to DashboardPage. All I want to do is once user is logged in and user is forwarded to Dashboard I want to update Swipe menu with Logged in user details.
In constructor of Dashboard page, I have published the event like this -
let userinfo = this.storagehelper.getStorageItem("userinfo");
this.event.publish("app:userLoggedIn", userinfo);
and in app.component.ts
, I subscribe to the event like this -
this.event.subscribe("app:userLoggedIn", userObject => {
console.warn("Listening to published event");
this.setMenuUsers(userObject);
});
setMenuUsers(userinfo){
this.LoginUserEmail = userinfo.UserName;
this.LoginUserName = userinfo.EmployeeName;
this.LoginUserCompany = userinfo.CompanyName;
}
PROBLEM
The menu is not getting updated, subscribe event is not working at all. Can anybody help what I am doing wrong?