error.js 409 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import { routerRedux } from 'dva/router';

const error = (e, dispatch) => {
  if (e.name === 401 || e.name === 403) {
    dispatch(routerRedux.push('/exception/403'));
    return;
  }
  if (e.name <= 504 && e.name >= 500) {
    dispatch(routerRedux.push('/exception/500'));
    return;
  }
  if (e.name >= 404 && e.name < 422) {
    dispatch(routerRedux.push('/exception/404'));
  }
};

export default error;