Подскажите, пожалуйста, как использовать actions и state из основного store в модулях Нужно получить в файле backend.js доступ к state и actions из основного store
//store.js
import { createStore } from 'vuex'
import backend from '@/store/modules/backend'
const store = createStore({
state: () => ({})
actions: {}
modules: {
backend
}
export default store
//backend.js
const mutations = {
HANDLE_CALL_BUTTON_CLICK(state) {
const isError = Math.random() < 0.5 ? true : false
if (!state.isCallInProgress && !isError) {
this.dispatch('startCall')
} else if (state.isCallInProgress) {
this.dispatch('hangUp')
} else {
this.dispatch('showFailedCallModal')
}
}
}
const actions = {
...
}
export default {
mutations,
actions,
}