feat(web): Helper for raw image type.
This commit is contained in:
@@ -93,12 +93,7 @@ async function fileUploader(
|
|||||||
formData.append('deviceId', 'WEB');
|
formData.append('deviceId', 'WEB');
|
||||||
|
|
||||||
// Get asset type
|
// Get asset type
|
||||||
if (fileExtension.toLowerCase() == 'raf' || fileExtension.toLowerCase() == 'srw') {
|
formData.append('assetType', isRawImageType(fileExtension) || assetType);
|
||||||
// Workaround for annoying RAW types.
|
|
||||||
formData.append('assetType', 'IMAGE');
|
|
||||||
} else {
|
|
||||||
formData.append('assetType', assetType);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Asset Created Date
|
// Get Asset Created Date
|
||||||
formData.append('createdAt', createdAt);
|
formData.append('createdAt', createdAt);
|
||||||
@@ -197,6 +192,14 @@ async function fileUploader(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isRawImageType(fileExtension: string): string | null {
|
||||||
|
const RAW_TYPES = ['raf', 'srw'];
|
||||||
|
if (RAW_TYPES.includes(fileExtension.toLowerCase())) {
|
||||||
|
return 'IMAGE';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
function handleUploadError(asset: File, respBody = '{}', extraMessage?: string) {
|
function handleUploadError(asset: File, respBody = '{}', extraMessage?: string) {
|
||||||
try {
|
try {
|
||||||
const res = JSON.parse(respBody);
|
const res = JSON.parse(respBody);
|
||||||
|
|||||||
Reference in New Issue
Block a user