update error handler

This commit is contained in:
smanylov
2026-02-04 16:10:16 +07:00
parent 40fa737208
commit e778cf7e33
6 changed files with 53 additions and 24 deletions
+5 -5
View File
@@ -196,15 +196,15 @@ export default function SectionSearchFile({ fileType, allowedExtensions, maxFile
const chunkResponse = await chunkUpload(formData);
if (chunkResponse.message_desc !== 'Chunk uploaded successfully') {
throw new Error(`Chunk ${chunkIndex} upload failed`);
if (chunkResponse.errorMesage !== null) {
throw chunkResponse.errorMesage;
}
setUploadProgress(Math.floor((chunkIndex + 1) / totalChunks * 100));
if (isLastChunk) {
setFileId(chunkResponse.message_body.file_id);
document.cookie = `searchedFileId=${chunkResponse.message_body.file_id}`
if (isLastChunk && chunkResponse.fileId) {
setFileId(chunkResponse.fileId);
document.cookie = `searchedFileId=${chunkResponse.fileId}`
}
}