diff --git a/front/src/AddBook.vue b/front/src/AddBook.vue index 7de5dcf..b5d141f 100644 --- a/front/src/AddBook.vue +++ b/front/src/AddBook.vue @@ -9,6 +9,11 @@ const router = useRouter() const book = ref({ title: '', author: '', + isbn: '', + inventaireid: '', + openlibraryid: '', + shortdescription: '', + summary: '', coverId: null, }) const errors = ref(null) @@ -18,11 +23,26 @@ const titleError = computed(() => { const authorError = computed(() => { return extractFormErrorFromField('Author', errors.value) }) +const isbnError = computed(() => { + return extractFormErrorFromField('ISBN', errors.value) +}) +const inventaireError = computed(() => { + return extractFormErrorFromField('InventaireID', errors.value) +}) +const openLibraryError = computed(() => { + return extractFormErrorFromField('OpenLibraryId', errors.value) +}) +const shortDescError = computed(() => { + return extractFormErrorFromField('ShortDescription', errors.value) +}) +const summaryError = computed(() => { + return extractFormErrorFromField('ShortDescription', errors.value) +}) function onSubmit(e) { postBook(book).then((res) => { if (res.ok) { - router.push('/') + res.json().then((json) => router.push('/book/' + json.id)) return } else { res.json().then((json) => (errors.value = json)) @@ -37,7 +57,7 @@ function onSubmit(e) {
{{ authorError }}
{{ shortDescError }}
+{{ summaryError }}
+{{ isbnError }}
+{{ inventaireError }}
+{{ openLibraryError }}
+