Within my state
, I have organized two namespace modules: portfolio
and stocks
. The structure looks like this:
export default new Vuex.Store({
modules: {
stocks,
portfolio
}
})
The stocks
module contains a property called stocks
, while the portfolio
module contains a property called funds
. I am attempting to utilize the BUY_STOCK
mutation, which requires access to both stocks
from the stocks
module and funds
from the profile
module. In the profile
module, I set it up as shown below:
"BUY_STOCK"(state, {stockId, quantity, stockPrice}) {
console.log(state.stocks.stocks, state.portfolio.funds)
}
However, I ended up receiving undefined
. This is because the state
being referenced is merely the local module state. How can I gain access to the global state from within this mutation?