Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄庭坚
jinfa-platform
Commits
ebecd7ef
Commit
ebecd7ef
authored
Dec 21, 2021
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 后端提示语国际化
parent
6dcc00c7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
request.ts
src/utils/request.ts
+4
-2
No files found.
src/utils/request.ts
View file @
ebecd7ef
import
{
extend
,
ResponseError
,
OnionOptions
,
RequestOptionsInit
,
ResponseInterceptor
,
OnionMiddleware
,
Context
,
RequestMethod
}
from
'umi-request'
;
import
responseCode
from
'@/constants/responseCode'
import
{
IRequestError
,
IRequestSuccess
}
from
'..'
;
import
{
history
}
from
'umi'
import
{
getIntl
}
from
'umi'
import
{
message
}
from
'antd'
import
{
getCookieAuth
,
removeAuth
}
from
'./auth'
;
import
{
GlobalConfig
}
from
'@/global/config'
;
...
...
@@ -25,6 +25,8 @@ export interface IApiRequest extends RequestOptionsInit {
type
httpStatus
=
{
[
key
:
number
]:
string
}
const
intl
=
getIntl
()
const
errorMessage
:
httpStatus
=
{
400
:
"发出的请求有错误,服务器没有进行新建或修改数据的操作。"
,
401
:
"用户没有权限(令牌、用户名、密码错误)。"
,
...
...
@@ -142,7 +144,7 @@ class ApiRequest {
if
(
url
!=
'/member/loginInfo'
)
{
// 这是展示接口错误信息,任何 ctlType 都可以,不然一些 get 请求出错了
// 错误信息无法展示给用户
res
.
message
&&
message
.
info
(
res
.
message
)
res
.
message
&&
message
.
info
(
intl
.
formatMessage
({
id
:
res
.
code
,
defaultMessage
:
res
.
message
})
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment