Even in identical situations, I am receiving different outputs from the same getter function.
console.log(store.getters);
When checking the console, I see: {}: auth/loggedIn: true
, which is the correct value. However, when specifically accessing this getter:
console.log(store.getters['auth/loggedIn']);
The output in the console shows: false
This inconsistency is puzzling.
In my auth.js
module:
auth = {
namespaced: true,
state: {
token: null
},
getters: {
loggedIn(state) {
return state.token !== null
}, ...
In my app.js
:
window.Vue = require('vue');
import Vue from 'vue'
...
import routes from './routes'
import {store} from './store/store`
...
console.log(store.getters['auth/loggedIn']);