Bildupload
This commit is contained in:
@@ -39,8 +39,6 @@
|
|||||||
|
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
const file = files[i];
|
const file = files[i];
|
||||||
images.push({ preview: true, benutzer_id: null, kategorie, created_at: new Date(), updated_at: new Date(), id: "" });
|
|
||||||
images = images;
|
|
||||||
|
|
||||||
if (file.type !== "image/jpeg" && file.type !== "image/png" && file.type !== "image/webp" && file.type !== "image/heif" && file.type !== "image/heic") {
|
if (file.type !== "image/jpeg" && file.type !== "image/png" && file.type !== "image/webp" && file.type !== "image/heif" && file.type !== "image/heic") {
|
||||||
continue;
|
continue;
|
||||||
@@ -50,6 +48,9 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
images.push({ preview: true, benutzer_id: null, kategorie, created_at: new Date(), updated_at: new Date(), id: "" });
|
||||||
|
images = images;
|
||||||
|
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
|
|
||||||
reader.onload = async () => {
|
reader.onload = async () => {
|
||||||
@@ -119,14 +120,19 @@
|
|||||||
dismissable: true
|
dismissable: true
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const placeholder = images.find((f) => f.kategorie === kategorie && f.preview === true);
|
const index = images.findIndex((img) => img.preview === true);
|
||||||
if (!placeholder) {
|
|
||||||
return;
|
if (index !== -1) {
|
||||||
|
delete images[index];
|
||||||
|
images = images.filter((img) => img);
|
||||||
}
|
}
|
||||||
placeholder!.preview = false;
|
images = [...images, {
|
||||||
placeholder!.id = result.id;
|
benutzer_id: null,
|
||||||
placeholder!.benutzer_id = ausweis.benutzer_id;
|
created_at: new Date(),
|
||||||
images = images;
|
updated_at: new Date(),
|
||||||
|
id: result.id,
|
||||||
|
kategorie
|
||||||
|
}];
|
||||||
|
|
||||||
if (i == Math.min(files.length, max) - 1) {
|
if (i == Math.min(files.length, max) - 1) {
|
||||||
this.value = "";
|
this.value = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user