Cancel file upload when session is terminated
This commit is contained in:
@ -93,5 +93,6 @@ func POST(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w.WriteHeader(http.StatusAccepted)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -163,10 +163,17 @@ async function uploadChunks(name, size, chunks, chunkArray, FileID) {
|
|||||||
|
|
||||||
const startTime = performance.now();
|
const startTime = performance.now();
|
||||||
try {
|
try {
|
||||||
await fetch(`/file/${FileID}`, {
|
const request = await fetch(`/file/${FileID}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
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) {
|
} catch (error) {
|
||||||
ChangeModal("Error", "There was an issue with your upload. Please try again later or contact support if the problem persists.")
|
ChangeModal("Error", "There was an issue with your upload. Please try again later or contact support if the problem persists.")
|
||||||
toggleModal();
|
toggleModal();
|
||||||
|
Reference in New Issue
Block a user