This commit is contained in:
phanphan 2024-06-19 15:33:33 +07:00
parent 64c9804c98
commit 6279fdc30c
2 changed files with 31 additions and 16 deletions

View File

@ -144,14 +144,16 @@ const ReviewPage = () => {
if (isEmpty(tempData[k][REVIEWED_RESULT])) {
isEmptyResult = true;
}
if (Array.isArray(tempData[k][REVIEWED_RESULT]) && tempData[k][REVIEWED_RESULT].length > 0) {
if (
Array.isArray(tempData[k][REVIEWED_RESULT]) &&
tempData[k][REVIEWED_RESULT].length > 0
) {
isEmptyResult = tempData[k][REVIEWED_RESULT].every((r: any) =>
isEmpty(r),
);
}
if (isEmptyResult) {
tempData[k][REVIEWED_RESULT] = tempData[k][PREDICTED_RESULT];
}
}
});
@ -195,13 +197,17 @@ const ReviewPage = () => {
}
setSelectedFileName(fileName);
try {
const response = await fetch(fileURL);
if (response.status === 200) {
setSelectedFileData(fileURL);
} else {
setSelectedFileData('FAILED_TO_LOAD_FILE');
setImageLoading(false);
}
} catch (error) {
setSelectedFileData('FAILED_TO_LOAD_FILE');
}
setImageLoading(false);
};
const loadCurrentRequest = (requestIndex) => {
setLoading(true);
@ -311,12 +317,11 @@ const ReviewPage = () => {
SOURCE_KEYS.forEach((k) => {
request_file_result[k] = selectedFileDataSource[k][REVIEWED_RESULT];
if (Array.isArray(selectedFileDataSource[k][REVIEWED_RESULT])) {
request_file_result[k] = selectedFileDataSource[k][REVIEWED_RESULT].toString();
request_file_result[k] =
selectedFileDataSource[k][REVIEWED_RESULT].toString();
} else {
request_file_result[k] = selectedFileDataSource[k][REVIEWED_RESULT];
}
});
let data = {
request_file_result,
@ -523,7 +528,17 @@ const ReviewPage = () => {
</div>
)}
{selectedFileData === 'FAILED_TO_LOAD_FILE' ? (
<div
style={{
flexGrow: 1,
overflow: 'auto',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
<p style={{ color: '#333' }}>Failed to load file.</p>
</div>
) : fileExtension === 'pdf' ? (
<div
style={{

View File

@ -11,7 +11,7 @@ const environment = process.env.NODE_ENV;
const AXIOS_TIMEOUT_MS = 30 * 60 * 1000; // This config sastified long-live upload file request
const EXPIRED_PASSWORD_SIGNAL = 'expired_password';
export const baseURL = environment === 'development' ? 'http://107.120.133.27:9000/api' : '/api';
export const baseURL = environment === 'development' ? 'http://107.120.133.27:9881/api' : '/api';
// export const baseURL = '/api';