Can anyone assist me with this issue? I am having trouble with my getters in Vuex not recognizing the state. Here is the code snippet: https://codesandbox.io/s/crazy-moon-35fiz?file=/store/user.js
user.js:
export const state = () => ({
user: {
isUserAuthenticated: false,
user_id: null,
}
})
export const getters = {
getUserAuthStatus: (state: any) => {
console.log('state', state) // it's null, why?
return state
}
}
When calling my getter in the component:
import { mapGetters } from 'vuex'
...
computed: {
...mapGetters({
isUserAuthenticated: 'user/getUserAuthStatus2',
}),
},
...