Resolve video upload issues.
This commit is contained in:
@@ -8,7 +8,6 @@ export const handleLocalUpload = async ({ ev, context }) => {
|
||||
const { onError, onSuccess, onProgress, filename, mediaId } = ev;
|
||||
const { jobid, invoice_number, vendorid, callbackAfterUpload } = context;
|
||||
const bodyshop = store.getState().user.bodyshop;
|
||||
|
||||
var options = {
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
@@ -28,7 +27,13 @@ export const handleLocalUpload = async ({ ev, context }) => {
|
||||
}
|
||||
const imageData = await MediaLibrary.getAssetInfoAsync(mediaId);
|
||||
|
||||
const newFile = await (await fetch(imageData.localUri)).blob();
|
||||
let newFile;
|
||||
try {
|
||||
newFile = await (await fetch(imageData.localUri || imageData.uri)).blob();
|
||||
} catch (error) {
|
||||
console.log("blobbing error", error, imageData.localUri || imageData.uri);
|
||||
}
|
||||
|
||||
let thumb;
|
||||
let fileData = {
|
||||
uri: null,
|
||||
@@ -51,10 +56,11 @@ export const handleLocalUpload = async ({ ev, context }) => {
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
onError && onError(error.message);
|
||||
}
|
||||
} else {
|
||||
fileData = {
|
||||
uri: imageData.localUri,
|
||||
uri: imageData.localUri || imageData.uri,
|
||||
type: newFile.type,
|
||||
name: filename,
|
||||
};
|
||||
@@ -76,7 +82,9 @@ export const handleLocalUpload = async ({ ev, context }) => {
|
||||
if (imexMediaServerResponse.status !== 200) {
|
||||
if (onError) {
|
||||
console.log(imexMediaServerResponse);
|
||||
onError(imexMediaServerResponse.statusText);
|
||||
onError(
|
||||
imexMediaServerResponse.data || imexMediaServerResponse.statusText
|
||||
);
|
||||
}
|
||||
} else {
|
||||
onSuccess && onSuccess();
|
||||
@@ -87,6 +95,6 @@ export const handleLocalUpload = async ({ ev, context }) => {
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error uploading documents:", onError, error);
|
||||
onError && onError(error);
|
||||
onError && onError(error.message);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user