import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
		realData: {},
		loginData: {},
		unpublishedData: {},
		superior: {},
		department: false,
		routerCanPush: false,
		showDialog: false,
		saveView: {},
  },
	getters: {
		getRealData(state) {
			return state.realData
		},
		getLoginData(state) {
			return state.loginData
		},
		getUnpublishedData(state) {
			return state.unpublishedData
		},
		getSuperior(state) {
			return state.superior
		},
		getDepartment(state) {
			return state.department
		},
		getRouterCanPush(state) {
			return state.routerCanPush
		},
		getShowDialog(state) {
			return state.showDialog
		},
		getSaveView(state) {
			return state.saveView
		},
	},
  mutations: {
		changeRealData(state, payload) {
			state.realData = payload;
		},
		changeLoginData(state, payload) {
			state.loginData = payload;
		},
		changeUnpublishedData(state, payload) {
			state.unpublishedData = payload;
		},
		changeSuperior(state, payload) {
			state.superior = payload;
		},
		changeDepartment(state, payload) {
			state.department = payload;
		},
		changeRouterCanPush(state, payload) {
			state.routerCanPush = payload;
		},
		changeShowDialog(state, payload) {
			state.showDialog = payload;
		},
		changeSaveView(state, payload) {
			state.saveView = payload;
		},
  },
  actions: {
		changeRealData(store, payload) {
			store.commit({
				type: 'changeRealData',
				realData: payload
			})
		},
		changeLoginData(store, payload) {
			store.commit({
				type: 'changeLoginData',
				realData: payload
			})
		},
		changeUnpublishedData(store, payload) {
			store.commit({
				type: 'changeUnpublishedData',
				unpublishedData: payload
			})
		},
		changeSuperior(store, payload) {
			store.commit({
				type: 'changeSuperior',
				superior: payload
			})
		},
		changeDepartment(store, payload) {
			store.commit({
				type: 'changeDepartment',
				superior: payload
			})
		},
		changeRouterCanPush(store, payload) {
			store.commit({
				type: 'changeRouterCanPush',
				routerCanPush: payload
			})
		},
		changeShowDialog(store, payload) {
			store.commit({
				type: 'changeShowDialog',
				showDialog: payload
			})
		},
		changeSaveView(store, payload) {
			store.commit({
				type: 'changeSaveView',
				saveView: payload
			})
		},
  },
  modules: {
  }
})
