fix: requestClient缺失i18n内容
This commit is contained in:
@@ -186,7 +186,7 @@ function createRequestClient(baseURL: string) {
|
||||
|
||||
const axiosResponseData = response.data;
|
||||
if (!axiosResponseData) {
|
||||
throw new Error($t('fallback.http.apiRequestFailed'));
|
||||
throw new Error($t('http.apiRequestFailed'));
|
||||
}
|
||||
|
||||
// ruoyi-plus没有采用严格的{code, msg, data}模式
|
||||
@@ -198,13 +198,13 @@ function createRequestClient(baseURL: string) {
|
||||
let successMsg = msg;
|
||||
|
||||
if (isNull(successMsg) || isEmpty(successMsg)) {
|
||||
successMsg = $t(`fallback.http.operationSuccess`);
|
||||
successMsg = $t(`http.operationSuccess`);
|
||||
}
|
||||
|
||||
if (response.config.successMessageMode === 'modal') {
|
||||
Modal.success({
|
||||
content: successMsg,
|
||||
title: $t('fallback.http.successTip'),
|
||||
title: $t('http.successTip'),
|
||||
});
|
||||
} else if (response.config.successMessageMode === 'message') {
|
||||
message.success(successMsg);
|
||||
@@ -247,13 +247,13 @@ function createRequestClient(baseURL: string) {
|
||||
if (response.config.errorMessageMode === 'modal') {
|
||||
Modal.error({
|
||||
content: timeoutMsg,
|
||||
title: $t('fallback.http.errorTip'),
|
||||
title: $t('http.errorTip'),
|
||||
});
|
||||
} else if (response.config.errorMessageMode === 'message') {
|
||||
message.error(timeoutMsg);
|
||||
}
|
||||
|
||||
throw new Error(timeoutMsg || $t('fallback.http.apiRequestFailed'));
|
||||
throw new Error(timeoutMsg || $t('http.apiRequestFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
|
6
apps/web-antd/src/locales/langs/en-US/http.json
Normal file
6
apps/web-antd/src/locales/langs/en-US/http.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"apiRequestFailed": "Operation failed",
|
||||
"operationSuccess": "Operation Success",
|
||||
"successTip": "Success Tip",
|
||||
"errorTip": "Error Tip"
|
||||
}
|
6
apps/web-antd/src/locales/langs/zh-CN/http.json
Normal file
6
apps/web-antd/src/locales/langs/zh-CN/http.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"apiRequestFailed": "请求出错,请稍候重试",
|
||||
"operationSuccess": "操作成功",
|
||||
"successTip": "成功提示",
|
||||
"errorTip": "错误提示"
|
||||
}
|
Reference in New Issue
Block a user