app.tsx 592 B

12345678910111213141516171819202122
  1. import { apiGetRoles } from './services/user'
  2. import { setAuthority } from './utils/auth/authority'
  3. // const PermDataList = [
  4. // {
  5. // key: '/customer',
  6. // value: 2
  7. // }
  8. // ]
  9. export function render(oldRender) {
  10. const path = window.location.pathname
  11. if (path !== '/user/login') {
  12. apiGetRoles().then(roles => {
  13. setAuthority(roles.data)
  14. // const permVal = PermDataList.find(item => path.startsWith(item.key))?.value
  15. // if (permVal) {
  16. // getDataPerm().then(prem => setAuthCache(PERM_LIST_KEY, prem?.data || []))
  17. // }
  18. })
  19. }
  20. oldRender()
  21. }