Cancel file upload when session is terminated

This commit is contained in:
2024-09-15 17:41:33 +07:00
parent eee047a9b0
commit 4ee86d0fc4
2 changed files with 9 additions and 1 deletions

View File

@ -163,10 +163,17 @@ async function uploadChunks(name, size, chunks, chunkArray, FileID) {
const startTime = performance.now();
try {
await fetch(`/file/${FileID}`, {
const request = await fetch(`/file/${FileID}`, {
method: 'POST',
body: formData
});
console.log(request.status)
if (request.status !== 202) {
ChangeModal("Error", "There was an issue with your upload. Please try again later or contact support if the problem persists.")
toggleModal();
isFailed = true
break
}
} catch (error) {
ChangeModal("Error", "There was an issue with your upload. Please try again later or contact support if the problem persists.")
toggleModal();