mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 00:27:41 +01:00
[ROMM-3025] Fix collections with custom art failing
This commit is contained in:
@@ -48,7 +48,7 @@ const collectionCoverImage = computed(() =>
|
||||
);
|
||||
|
||||
emitter?.on("updateUrlCover", (coverUrl) => {
|
||||
setArtwork(coverUrl);
|
||||
setCoverUrl(coverUrl);
|
||||
});
|
||||
|
||||
function showEditable() {
|
||||
@@ -73,16 +73,21 @@ function previewImage(event: Event) {
|
||||
const input = event.target as HTMLInputElement;
|
||||
if (!input.files) return;
|
||||
|
||||
// Set artwork from uploaded file
|
||||
updatedCollection.value.artwork = input.files[0];
|
||||
|
||||
// Display the image preview
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
setArtwork(reader.result?.toString() || "");
|
||||
imagePreviewUrl.value = reader.result?.toString() || "";
|
||||
removeCover.value = false;
|
||||
};
|
||||
if (input.files[0]) {
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function setArtwork(coverUrl: string) {
|
||||
function setCoverUrl(coverUrl: string) {
|
||||
if (!coverUrl) return;
|
||||
updatedCollection.value.url_cover = coverUrl;
|
||||
imagePreviewUrl.value = coverUrl;
|
||||
|
||||
@@ -34,7 +34,7 @@ emitter?.on("showCreateCollectionDialog", () => {
|
||||
removeCover.value = false;
|
||||
});
|
||||
emitter?.on("updateUrlCover", (coverUrl) => {
|
||||
setArtwork(coverUrl);
|
||||
setUrlCover(coverUrl);
|
||||
});
|
||||
|
||||
const missingCoverImage = computed(() =>
|
||||
@@ -50,16 +50,21 @@ function previewImage(event: Event) {
|
||||
const input = event.target as HTMLInputElement;
|
||||
if (!input.files) return;
|
||||
|
||||
// Set artwork from uploaded file
|
||||
collection.value.artwork = input.files[0];
|
||||
|
||||
// Display the image preview
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
setArtwork(reader.result?.toString() || "");
|
||||
imagePreviewUrl.value = reader.result?.toString() || "";
|
||||
removeCover.value = false;
|
||||
};
|
||||
if (input.files[0]) {
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function setArtwork(coverUrl: string) {
|
||||
function setUrlCover(coverUrl: string) {
|
||||
if (!coverUrl || !collection.value) return;
|
||||
collection.value.url_cover = coverUrl;
|
||||
imagePreviewUrl.value = coverUrl;
|
||||
@@ -78,7 +83,7 @@ async function createCollection() {
|
||||
|
||||
try {
|
||||
const { data } = await collectionApi.createCollection({
|
||||
collection: collection.value,
|
||||
collection: { ...collection.value },
|
||||
});
|
||||
|
||||
emitter?.emit("snackbarShow", {
|
||||
|
||||
@@ -38,7 +38,7 @@ emitter?.on("showEditRomDialog", (romToEdit: SimpleRom) => {
|
||||
});
|
||||
|
||||
emitter?.on("updateUrlCover", (url_cover) => {
|
||||
setArtwork(url_cover);
|
||||
setUrlCover(url_cover);
|
||||
});
|
||||
|
||||
const missingCoverImage = computed(() =>
|
||||
@@ -51,19 +51,26 @@ function triggerFileInput(id: string) {
|
||||
}
|
||||
|
||||
function previewImage(event: Event) {
|
||||
if (!rom.value) return;
|
||||
|
||||
const input = event.target as HTMLInputElement;
|
||||
if (!input.files) return;
|
||||
|
||||
// Set artwork from uploaded file
|
||||
rom.value.artwork = input.files[0];
|
||||
|
||||
// Display the image preview
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
setArtwork(reader.result?.toString() || "");
|
||||
imagePreviewUrl.value = reader.result?.toString() || "";
|
||||
removeCover.value = false;
|
||||
};
|
||||
if (input.files[0]) {
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function setArtwork(coverUrl: string) {
|
||||
function setUrlCover(coverUrl: string) {
|
||||
if (!coverUrl || !rom.value) return;
|
||||
rom.value.url_cover = coverUrl;
|
||||
imagePreviewUrl.value = coverUrl;
|
||||
|
||||
Reference in New Issue
Block a user