Unified API response json schema (#3170)

### What problem does this PR solve?

Unified API response json schema

### Type of change

- [x] Refactoring
This commit is contained in:
Zhichang Yu
2024-11-05 11:02:31 +08:00
committed by GitHub
parent 339639a9db
commit 185c6a0c71
53 changed files with 1458 additions and 1470 deletions

View File

@ -109,21 +109,21 @@ request.interceptors.response.use(async (response: any, options) => {
const data: ResponseType = await response.clone().json();
if (data.retcode === 401 || data.retcode === 401) {
if (data.code === 401 || data.code === 401) {
notification.error({
message: data.retmsg,
description: data.retmsg,
message: data.message,
description: data.message,
duration: 3,
});
authorizationUtil.removeAll();
history.push('/login'); // Will not jump to the login page
} else if (data.retcode !== 0) {
if (data.retcode === 100) {
message.error(data.retmsg);
} else if (data.code !== 0) {
if (data.code === 100) {
message.error(data.message);
} else {
notification.error({
message: `${i18n.t('message.hint')} : ${data.retcode}`,
description: data.retmsg,
message: `${i18n.t('message.hint')} : ${data.code}`,
description: data.message,
duration: 3,
});
}