import Vue from 'vue'
import Vuex from 'vuex'
import app from "./modules/app"
import user from "./modules/user"
import dict from "./modules/dict"
import follow from "./modules/follow"
import call from "./modules/call.js"
import getters from "./getters";
import createPersistedState from 'vuex-persistedstate'
import {
	localStorage
} from 'mp-storage'

Vue.use(Vuex)
const store = new Vuex.Store({
	modules: {
		app,
		user,
		dict,
		follow,
		call
	},
	getters,
	state: {
		hasLogin: false,
	},
	mutations: {},
	actions: {

	},
	plugins: [
		createPersistedState({
			storage: localStorage,
			paths: ['user'],
			reducer: function(state) {
				return {
					user: {
						// 只保存 user 中除了 netConfig 以外的其他属性
						...state.user,
						netConfig: undefined // 显式排除 netConfig
					}
				}
			}
		})
	],
})

export default store