Does it work?
This commit is contained in:
parent
fe05d8ddc1
commit
c56b0b786a
@ -44,20 +44,20 @@ async function drawTable() {
|
||||
});
|
||||
}
|
||||
|
||||
async function addLine(item, name, authorId, year, image) {
|
||||
async function addLine(categoriesId, name, authorId, year, image) {
|
||||
console.info("Try to add item");
|
||||
// вызов метода REST API для добавления записи
|
||||
const data = await addBook(item, name, authorId, year, image);
|
||||
const data = await addBook(categoriesId, name, authorId, year, image);
|
||||
console.info("Added");
|
||||
console.info(data);
|
||||
// загрузка и заполнение table
|
||||
drawTable();
|
||||
}
|
||||
|
||||
async function editLine(id, item, name, authorId, year, image) {
|
||||
async function editLine(id, categoriesId, name, authorId, year, image) {
|
||||
console.info("Try to update item");
|
||||
// вызов метода REST API для обновления записи
|
||||
const data = await updateBook(id, item, name, authorId, year, image);
|
||||
const data = await updateBook(id, categoriesId, name, authorId, year, image);
|
||||
console.info("Updated");
|
||||
console.info(data);
|
||||
// загрузка и заполнение table
|
||||
@ -106,9 +106,9 @@ export async function linesPageForm() {
|
||||
if (currentId) {
|
||||
try {
|
||||
const book = await getBook(currentId);
|
||||
cntrls.categoryInput.value = book.itemsId;
|
||||
cntrls.categoryInput.value = book.categoriesId;
|
||||
cntrls.nameInput.value = book.name;
|
||||
cntrls.authorInput.value = book.authorId;
|
||||
cntrls.authorInput.value = book.authorsId;
|
||||
cntrls.yearInput.value = book.year;
|
||||
cntrls.imagePreview.src = book.image ? book.image : imagePlaceholder;
|
||||
} catch {
|
||||
|
@ -51,7 +51,7 @@
|
||||
<form id="items-form" class="needs-validation" novalidate>
|
||||
<div class="mb-2">
|
||||
<label for="item" class="form-label orange-text fs-4">Категории</label>
|
||||
<select id="item" class="form-select fs-4" name="selected" required>
|
||||
<select id="item" class="form-select fs-4" name="selected1" required>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
@ -60,7 +60,7 @@
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<label for="author" class="form-label orange-text fs-4">Автор</label>
|
||||
<select id="author" class="form-select fs-4" name="selected" required>
|
||||
<select id="author" class="form-select fs-4" name="selected2" required>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
|
Loading…
Reference in New Issue
Block a user