add images modal upload fully working (for images from banks and new images)
This commit is contained in:
parent
0e656e1920
commit
514c4bd86b
8 changed files with 84 additions and 86 deletions
|
|
@ -169,12 +169,21 @@ const images = computed(() => {
|
|||
function addImagesToBrief() {
|
||||
const formData = new FormData();
|
||||
|
||||
const blobPromises = images.value.map((item) => {
|
||||
const blobPromises = images.value.map((item, index) => {
|
||||
console.log(item);
|
||||
if (item.url.startsWith("blob:")) {
|
||||
return fetch(item.url)
|
||||
.then((response) => response.blob())
|
||||
.then((blob) => {
|
||||
formData.append("images[]", blob, JSON.stringify(item));
|
||||
formData.append("images[]", blob, item.name);
|
||||
formData.append(
|
||||
`imagesMeta[${index}][description]`,
|
||||
item.description
|
||||
);
|
||||
formData.append(
|
||||
`imagesMeta[${index}][tags]`,
|
||||
JSON.stringify(item.tags)
|
||||
);
|
||||
});
|
||||
} else {
|
||||
formData.append("imageUris[]", JSON.stringify(item));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue