add navagation handler while file upload
This commit is contained in:
@@ -66,6 +66,7 @@ export async function fileUpload(messageBody: initMessageBody) {
|
||||
|
||||
export async function cancelUpload(udloadId: string) {
|
||||
try {
|
||||
console.log('cancelUpload start');
|
||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
@@ -93,6 +94,7 @@ export async function cancelUpload(udloadId: string) {
|
||||
};
|
||||
|
||||
if (parsed.message_desc === 'Upload cancelled successfully') {
|
||||
console.log('cancelUpload done');
|
||||
return parsed.message_body;
|
||||
} else {
|
||||
throw parsed;
|
||||
@@ -101,6 +103,7 @@ export async function cancelUpload(udloadId: string) {
|
||||
throw (`${response.status}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('cancelUpload error');
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user