
const state = {
  userinfo: ''
  // token: getToken(),
  // name: '',
  // avatar: '',
  // roles: [],
  // permissions: []
}

const mutations = {
  updateUser: (state, user) => {
    state.userinfo = user
  }
  // SET_TOKEN: (state, token) => {
  //   state.token = token
  // },
  // SET_NAME: (state, name) => {
  //   state.name = name
  // },
  // SET_AVATAR: (state, avatar) => {
  //   state.avatar = avatar
  // },
  // SET_ROLES: (state, roles) => {
  //   state.roles = roles
  // },
}

const actions = {
  changeSetting({ commit }, user) {
    commit('updateUser', user)
  },
  // get user info
  getInfo({ commit, state }) {
    return state.userinfo
  }
}

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

// export default user

