index.js 684 Bytes
import Vue from 'vue';
import Vuex from 'vuex';
import {createApi} from 'create-api';
import storeYoho from './yoho';
import storeOrder from './order';
import storeList from './list';
import storeProduct from './product';
import storeHome from './home';

Vue.use(Vuex);

export function createStore(context) {
  const store = new Vuex.Store({
    namespaced: true,
    modules: {
      yoho: storeYoho(),
      order: storeOrder(),
      list: storeList(),
      produt: storeProduct(),
      home: storeHome()
    },
    strict: process.env.NODE_ENV !== 'production'
  });

  const api = createApi(context, store);

  store.$api = api;
  store.$context = context;

  return store;
}