const state = {
  leftMenuWidth: '200px',
  isCollapse: false,
  isShowLanguage: false
}

const mutations = {
  CHANGE_COLLAPSE: (state) => {
    state.isCollapse = !state.isCollapse
    if (state.isCollapse) {
      state.leftMenuWidth = 'auto'
    } else {
      state.leftMenuWidth = '200px'
    }
  },
  SHOW_LANGUAGE: (state, showLanguage) => {
    state.isShowLanguage = showLanguage
  }
}

const actions = {
  changeCollapse (context) {
    context.commit('CHANGE_COLLAPSE')
  },
  changeLanguage (context, showLanguage) {
    context.commit('SHOW_LANGUAGE', showLanguage)
  }
}

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