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

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    realData: {},
		loginData: {},
		unpublishedData: {},
		superior: {},
		department: false
  },
  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.getDepartment
		},
  },
  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;
		},
  },
  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
			})
		},
  },
  modules: {
  }
})
