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,
  visitedViews: state => state.tagsView.visitedViews,
  cachedViews: state => state.tagsView.cachedViews,
  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,
  outletList: state => state.common.outletList,
  categoryArr: state => state.common.categoryArr,
  goodsAttrArr: state => state.common.goodsAttrArr,
  goodsArr: state => state.common.goodsArr
}
export default getters
