I have two Vuex stores inside the Nuxt store
directory. I'm not able to access one store's states from another, even through routeState
.
Store 1: index.js
export const state = () => ({
token: false
})
export const getters = {}
export const mutations = {}
export const actions = {}
Store 2: api.js
export const state = () => ({
apiBase: 'https://myurl.com/'
})
export const getters = {
getAPI: (state, rootState) => {
// Need the state token from index.js here
},
}
export const mutations = {}
export const actions = {}
Here,
state
returns the state variables inapi.js
, that isapiBase
routeState
returns the getters inapi.js
this
is undefined inside Vuex getters, it doesn't work
How do I access the state or getters from index.js?