Second commit

added few test, first api to add book
This commit is contained in:
2025-09-23 17:16:48 +02:00
parent 0457ca2011
commit 8432902df1
19 changed files with 298 additions and 123 deletions

41
front/src/AddBook.vue Normal file
View File

@@ -0,0 +1,41 @@
<script setup>
import { ref } from 'vue'
import { postBook } from './api.js'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter();
const book = ref({
title: "",
author: ""
});
function onSubmit(e) {
postBook(book);
router.push('/');
}
</script>
<template>
<form @submit.prevent="onSubmit">
<div class="field">
<label class="label">Title</label>
<div class="control">
<input class="input" type="text" v-model="book.title" placeholder="Title">
</div>
</div>
<div class="field">
<label class="label">Author</label>
<div class="control">
<input class="input" type="text" v-model="book.author" placeholder="Author">
</div>
</div>
<div class="field">
<div class="control">
<button class="button is-link">Submit</button>
</div>
</div>
</form>
</template>
<style scoped></style>