import ajax from '../../util/ajax'
import api from '../../util/api'

export default {
  namespaced: true,
  state: {
    userinfo: {},
  },
  mutations: {
    updateInfo (state, payload) {
      state.userinfo = payload || {}
    },
  },
  actions: {
    GetUserByTel ({ commit }, { tel }) {
      ajax(api.systemSet.getUserByTel.url, {
        method: api.systemSet.getUserByTel.method,
        urlData: {
          tel,
        }
      }).then(res => {
        commit('updateInfo', res)
      })
    },
    SetUserInfoNull ({ commit }) {
      commit('updateInfo', {})
    }
  }
}
