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

@ -148,20 +148,20 @@ export const useHandleUploadDocument = () => {
async (fileList: UploadFile[]): Promise<number | undefined> => {
if (fileList.length > 0) {
const ret: any = await uploadDocument(fileList);
if (typeof ret?.retmsg !== 'string') {
if (typeof ret?.message !== 'string') {
return;
}
const count = getUnSupportedFilesCount(ret?.retmsg);
const count = getUnSupportedFilesCount(ret?.message);
/// 500 error code indicates that some file types are not supported
let retcode = ret?.retcode;
let code = ret?.code;
if (
ret?.retcode === 0 ||
(ret?.retcode === 500 && count !== fileList.length) // Some files were not uploaded successfully, but some were uploaded successfully.
ret?.code === 0 ||
(ret?.code === 500 && count !== fileList.length) // Some files were not uploaded successfully, but some were uploaded successfully.
) {
retcode = 0;
code = 0;
hideDocumentUploadModal();
}
return retcode;
return code;
}
},
[uploadDocument, hideDocumentUploadModal],