import store from './index'
const getters = {
  sidebar: state => state.app.sidebar,
  permission_routes: state => state.permission.routes,
  pageRoleArray: state => state.permission.pageRoleArray,
  device: state => state.app.device,
  token: state => state.user.token,
  avatar: state => state.user.avatar,
  name: state => state.user.name,
  // projectArr: state => state.user.projectArr,
  projectArr: state => {
    if (state.common.projectArr.length == 0) {
      store.dispatch('common/setProjectArr')
    }
    return state.common.projectArr 
  },
  departmentArr: state => state.common.departmentArr,
  roleArr: state => state.common.roleArr,
  // departmentArr: state => {
  //   if (state.common.departmentArr.length == 0) {
  //     store.dispatch('common/setDepartmentArr')
  //   }
  //   return state.common.departmentArr 
  // },
  // roleArr: state => {
  //   if (state.common.roleArr.length == 0) {
  //     store.dispatch('common/setRoleArr')
  //   }
  //   return state.common.roleArr 
  // }
}
export default getters
