Fixed progress + new path + combined new

Co-Authored-By: Ajay Thapliyal <ajaythapliyal1703@gmail.com>
This commit is contained in:
Alex
2023-03-19 14:38:29 +00:00
parent 7dcbed644a
commit 796b4899aa
4 changed files with 40 additions and 31 deletions

View File

@@ -67,19 +67,26 @@ export default function Upload({
(progress?.percentage ?? 0) < 100 &&
setTimeout(() => {
const apiHost = import.meta.env.VITE_API_HOST;
fetch(`${apiHost}/api/task_status}?task_id=${progress?.taskId}`)
fetch(`${apiHost}/api/task_status?task_id=${progress?.taskId}`)
.then((data) => data.json())
.then((data) => {
if (data.status == 'SUCCESS') {
getDocs().then((data) => dispatch(setSourceDocs(data)));
setProgress(
(progress) => progress && { ...progress, percentage: 100 },
);
} else {
setProgress(
(progress) =>
progress && {
...progress,
percentage: data.result.current,
},
);
}
setProgress(
(progress) =>
progress && { ...progress, percentage: data.result.current },
);
});
}, 5000);
}, []);
}, [progress, dispatch]);
return (
<Progress
title="Training is in progress"