import Vue from 'vue'
import Vuex from 'vuex'
import actions from './actions.js'
Vue.use(Vuex)
export default new Vuex.Store({
	// state: 存储基本数据
	state: {
		user: {
			age: "",
			aud_id: "",
			email: "",
			gender: "",
			head_pic: "",
			height: "",
			is_use_set_kcal: "",
			nickname: "",
			set_kcal: "",
			tel: "",
			token: "",
			weight: ""
		},
    menu_search_value: '',
		foodList: [],
		menuList: [],
		isConnected: false,
		isBluetoothTyle: false,
	},
	// mutations:  Store中更改state数据状态的唯一方法(必须是同步函数)
	mutations: {
		/* 用户信息 */
		changeUserInfo(state, newData) {
			state.user = newData
		},
		//蓝牙状态
		changeBluetooth(state, newData) {
			state.isBluetoothTyle = newData
		},
		// 蓝牙连接状态
		changeConnected(state, newData) {
			state.isConnected = newData
		},
		// 菜谱
		changeMenuList(state, newData) {
			state.menuList = newData
		},
		changeFoodList(state, newData) {
			state.foodList = newData
		},
	},
	// 模块化vuex
	modules: {},
	actions
})