Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
fix: 返回 422 错误时根据返回结果提示错误信息
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Jun 29, 2018
1 parent a245e38 commit 1e593fd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ instance.interceptors.response.use(
case 408:
err.tips = "请求超时";
break;
case 422: {
const { data: { message = "错误请求" } = {} } = err.response;
err.tips = message;
break;
}
case 500:
err.tips = "服务器端出错";
break;
Expand Down

0 comments on commit 1e593fd

Please sign in to comment.