Skip to content

Commit

Permalink
cancelling upload no longer indicates a failure
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshiel committed Jun 23, 2021
1 parent bb8b8b6 commit 406a610
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions client/src/hooks/graphql/use-with-upload-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,12 @@ export function useWithUploadStatus(
});
})
.catch((err) => {
console.error(err);
addOrEditTask({
question,
uploadStatus: UploadStatus.UPLOAD_FAILED,
uploadStatus:
err.message && err.message === UploadStatus.CANCELLED
? UploadStatus.CANCELLED
: UploadStatus.UPLOAD_FAILED,
uploadProgress: 0,
taskId: "",
});
Expand All @@ -181,7 +183,7 @@ export function useWithUploadStatus(

function cancelUpload(mentorId: string, task: UploadTask) {
if (!task.taskId) {
task.tokenSource?.cancel();
task.tokenSource?.cancel(UploadStatus.CANCELLED);
addOrEditTask({
...task,
uploadStatus: UploadStatus.CANCELLED,
Expand Down

0 comments on commit 406a610

Please sign in to comment.