nikogu 9 years ago
parent
commit
6470e034d1
  1. 3
      src/components/GlobalFooter/index.less
  2. 21
      src/utils/request.js

3
src/components/GlobalFooter/index.less

@ -1,7 +1,8 @@
@import "~antd/lib/style/themes/default.less";
.globalFooter {
margin: 32px 28px 16px;
padding: 16px;
margin: 32px 0 16px 0;
text-align: center;
.links {

21
src/utils/request.js

@ -1,13 +1,28 @@
import fetch from 'dva/fetch';
import { notification } from 'antd';
function checkStatus(response) {
if (response.status >= 200 && response.status < 300) {
return response;
}
const error = new Error(response.statusText);
error.response = response;
throw error;
return response.json().then((result) => {
if (result.code) {
notification.error({
message: result.name,
description: result.message,
});
}
if (result.stack) {
notification.error({
message: '请求错误',
description: result.message,
});
}
const error = new Error(result.message);
error.response = response;
throw error;
});
}
/**

Loading…
Cancel
Save