import { apiGetRoles } from './services/user'
import { setAuthority } from './utils/auth/authority'

// const PermDataList = [
//   {
//     key: '/customer',
//     value: 2
//   }
// ]
export function render(oldRender) {
  const path = window.location.pathname
  if (path !== '/user/login') {
    apiGetRoles().then(roles => {
      setAuthority(roles.data)
      // const permVal = PermDataList.find(item => path.startsWith(item.key))?.value
      // if (permVal) {
      //   getDataPerm().then(prem => setAuthCache(PERM_LIST_KEY, prem?.data || []))
      // }
    })
  }
  oldRender()
}
