Does it work?

This commit is contained in:
Zakharov_Rostislav 2023-12-02 20:03:12 +04:00
parent fe05d8ddc1
commit c56b0b786a
2 changed files with 8 additions and 8 deletions

View File

@ -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"); console.info("Try to add item");
// вызов метода REST API для добавления записи // вызов метода 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("Added");
console.info(data); console.info(data);
// загрузка и заполнение table // загрузка и заполнение table
drawTable(); 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"); console.info("Try to update item");
// вызов метода REST API для обновления записи // вызов метода 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("Updated");
console.info(data); console.info(data);
// загрузка и заполнение table // загрузка и заполнение table
@ -106,9 +106,9 @@ export async function linesPageForm() {
if (currentId) { if (currentId) {
try { try {
const book = await getBook(currentId); const book = await getBook(currentId);
cntrls.categoryInput.value = book.itemsId; cntrls.categoryInput.value = book.categoriesId;
cntrls.nameInput.value = book.name; cntrls.nameInput.value = book.name;
cntrls.authorInput.value = book.authorId; cntrls.authorInput.value = book.authorsId;
cntrls.yearInput.value = book.year; cntrls.yearInput.value = book.year;
cntrls.imagePreview.src = book.image ? book.image : imagePlaceholder; cntrls.imagePreview.src = book.image ? book.image : imagePlaceholder;
} catch { } catch {

View File

@ -51,7 +51,7 @@
<form id="items-form" class="needs-validation" novalidate> <form id="items-form" class="needs-validation" novalidate>
<div class="mb-2"> <div class="mb-2">
<label for="item" class="form-label orange-text fs-4">Категории</label> <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> </select>
</div> </div>
<div class="mb-2"> <div class="mb-2">
@ -60,7 +60,7 @@
</div> </div>
<div class="mb-2"> <div class="mb-2">
<label for="author" class="form-label orange-text fs-4">Автор</label> <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> </select>
</div> </div>
<div class="mb-2"> <div class="mb-2">