import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'
import axios from 'axios'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    /*radiationObj:{data:null,time:null},*/
   /* temperatureObj:{data:null,time:null},*/
    otherObj:{data:null,time:null},
  },
  mutations: {
    //向state 里面设置数据
   /* changeRadiation(state, radiationObj) {
      state.radiationObj = radiationObj
    },*/
   /* changeTemperature(state, temperatureObj) {
      state.temperatureObj = temperatureObj
    },*/
    changeOther(state, otherObj) {
      state.otherObj = otherObj
    },
    SET_GS: (state, gs) => {
      state.gs = gs
    }

  },
  modules: {
    app,
    settings,
    user
  },
  actions:{
     getGs({commit}) {
      const a = this.$axios
      return new Promise(resolve => {
        axios.get('/reportVersion/gs').then(resp => {

          var data = resp.data.data

          commit('SET_GS', data)
          resolve(data)
        })

      })
    },
  },
  getters
})

export default store
