This commit is contained in:
User
2025-01-04 14:04:53 +03:00
parent cdca2437b9
commit 4393a97a95
41 changed files with 23557 additions and 2 deletions

3
frontend/js/main.js Normal file
View File

@@ -0,0 +1,3 @@
document.addEventListener('DOMContentLoaded', () => {
console.log('Marketplace loaded!');
});

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);
});
}