Reputation: 421
I created 2 modules:
When a user is being logged in, I retreive the firstname and lastname which I store as: state.auth.user.firstname and state.auth.user.lastname.
As I created a view which shows the user data in HTML, I want to retrieve user information through the User module with the following function:
const getters = {
currentUserAccount(rootState){
return rootState.auth.user;
}
};
Unfortunately this does not work. Can someone tell me what I can do best?
Upvotes: 0
Views: 41
Reputation: 385
rootState is passed via 3rd argument
const getters = {
currentUserAccount(state, getters, rootState){
return rootState.auth.user;
}
};
Upvotes: 2