This commit is contained in:
User
2025-01-03 21:26:43 +03:00
parent 55afc6215f
commit 387fcae36b
34 changed files with 23138 additions and 2 deletions

17
frontend/js/product.js Normal file
View File

@@ -0,0 +1,17 @@
// Обработчик для кнопки добавления в корзину
function addToCart(productId) {
fetch(`/api/cart/add`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ productId }),
})
.then(response => response.json())
.then(data => {
alert('Товар добавлен в корзину');
})
.catch(error => {
console.error('Ошибка:', error);
});
}