no redux
This commit is contained in:
@@ -341,10 +341,18 @@ export function collectFilesForUpload(attachments = [], { onlyNew = false } = {}
|
||||
}
|
||||
}
|
||||
|
||||
let thumbavif = null;
|
||||
if (attachment.thumbnail) {
|
||||
thumbavif = attachment.thumbnail.includes(',')
|
||||
? attachment.thumbnail.split(',')[1]
|
||||
: attachment.thumbnail;
|
||||
}
|
||||
|
||||
files.push({
|
||||
file: fileToUpload,
|
||||
name: attachment.name || fileToUpload.name,
|
||||
mimetype: attachment.type || fileToUpload.type,
|
||||
thumbavif,
|
||||
});
|
||||
}
|
||||
return files;
|
||||
@@ -389,6 +397,10 @@ export async function buildManifestBody(
|
||||
const filesToUpload = collectFilesForUpload(form.attachments, { onlyNew: isUpdate });
|
||||
if (filesToUpload.length > 0) {
|
||||
const formData = new FormData();
|
||||
body.filesMeta = filesToUpload.map((item) => ({
|
||||
name: item.name,
|
||||
thumbavif: item.thumbavif ?? null,
|
||||
}));
|
||||
formData.append('data', JSON.stringify(body));
|
||||
for (const item of filesToUpload) {
|
||||
formData.append('files', item.file, item.name);
|
||||
|
||||
Reference in New Issue
Block a user