hi guys, is there a recommended way in angular to store session data ? Like the username, the role of the user and stuff of that sort ? I come from Vue and there we use a store, which lives for the entire lifecycle of the webapp and you can save and retrieve data from there
i see there's NgRx, but is that the actual correct solution to use ? Is there a more conventional way of doing it ?
#Storing session data
7 messages · Page 1 of 1 (latest)
I've personally haven't used NgRx yet, all I know is that it is a very nice solution for quite complex application. If your goal is to store session data, you could declare your own UserService or AuthService where you have the username: string, role: RoleEnum, and many more properties which you can obtain by injecting that User/AuthService into your component and referencing those keys.
makes sense, to persist the data i would save to LocalStorage, right ?
One common pattern for storing state is to use Subjects or BehaviourSubjects from rxjs
Correct.