Manage display of book covers

This commit is contained in:
2025-10-28 18:35:36 +01:00
parent 8b8eee8210
commit b4df375e4c
20 changed files with 257 additions and 353 deletions

View File

@@ -2,6 +2,7 @@
import { ref, computed } from 'vue'
import { postImage } from './api.js'
const emit = defineEmits(['OnImageUpload'])
const props = defineProps({
name: String
});
@@ -12,10 +13,15 @@
function onFileChanged(e) {
postImage(e.target.files[0])
.then((res) => res.json())
.then((json) => (imagePath.value = json["filepath"]))
.then((json) => onJsonResult(json))
.catch((err) => (error.value = err["error"]));
}
function onJsonResult(json) {
imagePath.value = json["filepath"];
emit('OnImageUpload', json["fileId"])
}
function unsetImage() {
imagePath.value = null;
}