index.js 744 Bytes
import Vue from 'vue';
import Vuex from 'vuex';
import {createApi} from 'create-api';
import storeYoho from './yoho';
import storeUfo from './order';
import storeLicense from './license';
import storeMine from './mine';
import storeInvite from './invite';
import storeGain from './gain';

Vue.use(Vuex);

export function createStore(context) {
  const store = new Vuex.Store({
    namespaced: true,
    modules: {
      yoho: storeYoho(),
      ufo: storeUfo(),
      license: storeLicense(),
      mine: storeMine(),
      invite: storeInvite(),
      gain: storeGain()
    },
    strict: process.env.NODE_ENV !== 'production'
  });

  const api = createApi(context, store);

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

  return store;
}