আমি অ্যাক্সেস করতে চান state.session
মধ্যে instance.js
থেকে records_view.js
। এটি কীভাবে সম্পন্ন হয়?
স্টোর / মডিউল / উদাহরণ.js
const state = {
// This is what I want to access in records_view.js
session: {}
};
const getters = {
sessionGetter: state => state.session
};
স্টোর / মডিউল / রেকর্ড_ভিউ.জেএস
const actions = {
getSettingsAction (context, props) {
// This is how I'm trying to access session, which doesn't work
let session = context.state.instance.session;
Api(
context,
{
noun: props.noun,
verb: 'GetRecordsViewSettings',
orgUnitKey: _.has(session, 'orgunit.key') ? session.orgunit.key : '',
data: {}
},
props.callback
);
}
};
এটি যুক্ত করা প্রসঙ্গে কিছুটা।
store / index.js
import Vue from 'vue';
import Vuex from 'vuex';
import * as actions from './actions';
import * as getters from './getters';
import * as types from './mutation-types';
import instance from './modules/instance';
import recordsView from './modules/records_view';
Vue.use(Vuex);
export default new Vuex.Store({
state,
actions,
getters,
mutations,
modules: {
instance,
recordsView
}
});