error.js 409 B

1234567891011121314151617
  1. import { routerRedux } from 'dva/router';
  2. const error = (e, dispatch) => {
  3. if (e.name === 401 || e.name === 403) {
  4. dispatch(routerRedux.push('/exception/403'));
  5. return;
  6. }
  7. if (e.name <= 504 && e.name >= 500) {
  8. dispatch(routerRedux.push('/exception/500'));
  9. return;
  10. }
  11. if (e.name >= 404 && e.name < 422) {
  12. dispatch(routerRedux.push('/exception/404'));
  13. }
  14. };
  15. export default error;