Binu
Binu

Reputation: 83

Access state of namespaced module inside router

I'm having trouble accessing the state of one of my namespaced modules inside my router. I imported my store

import store from "../store"

and acessing my getters like this works fine

let loggedIn = store.getters['auth/isLoggedIn'];

but this only gives me back undefined:

let loggedIn = store.state['auth/user'];

How do I access my store?

Upvotes: 0

Views: 201

Answers (1)

Igor Moraru
Igor Moraru

Reputation: 7739

For direct access to store state:

let loggedIn = store.state.auth.user;

Upvotes: 1

Related Questions