forked from huge/frontEnd/hugeOA

Mr Ke
2020-05-29 a4f102defd2c7918617717f3307b6a3ef63859ff
src/api/request.js
@@ -3,7 +3,9 @@
import { message } from 'antd';
import { NetworkState, BASE_URL, MockUrl } from './httpurl';
import { createHashHistory } from 'history';
const CODE_SUCCESS = '200';
const history = createHashHistory();
let recognitionParams = [].reduce((p, n) => {
  if (eval(n)) {
@@ -64,8 +66,7 @@
        code == '10003'
      ) {
        // token失效重新返回登录页面
        // this.props.history.push({ pathname: '/login' });
        window.location.href = window.location.origin + '#/login';
        history.push('/login');
      } else {
        message.warning(msg);
        return false;
@@ -73,6 +74,6 @@
    })
    .catch((err) => {
      console.log(err);
      window.location.href = window.location.origin + '#/login';
      // history.push('/login');
    });
}