const state = {
	clickInfo: {
		layerName: null,
		value: null,
		feature: null,
		isClick: false,
		e: null
	},
	hoverInfo: {
		layerName: null,
		value: null,
		feature: null
	},
}

const mutations = {
	SET_INFO (state: { clickInfo: any; hoverInfo: any }, {data, type}: any) {
		if (type === 'click') {
			state.clickInfo = data
		} else if (type === 'hover') {
			state.hoverInfo = data
		}
	},
}

const actions = {
	// @ts-ignore
	LOAD_INFO ({ commit }, {data, type}) {
		commit('SET_INFO', {data, type})
	},
}

export default {
	namespaced: true,
	state,
	mutations,
	actions
}
