fix view_product

uebung_entities
michael 2025-01-16 10:55:10 +01:00
parent 78856751ff
commit a48d8255bf
2 changed files with 8 additions and 1 deletions

View File

@ -17,7 +17,13 @@ const Model = {
},
async fetchProduct(productId) {
const response = await fetch(`http://127.0.0.1:8000/view_product/${productId}`);
const response = await fetch(`http://127.0.0.1:8000/view_product/`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ product_id: productId }),
});
return response.json();
},
};

View File

@ -39,6 +39,7 @@ const View = {
},
renderProduct(product) {
var product = product.product;
const main = document.getElementById('main');
main.innerHTML = `
<h1>${product.name}</h1>