fix view_product
parent
78856751ff
commit
a48d8255bf
|
|
@ -17,7 +17,13 @@ const Model = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async fetchProduct(productId) {
|
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();
|
return response.json();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -39,6 +39,7 @@ const View = {
|
||||||
},
|
},
|
||||||
|
|
||||||
renderProduct(product) {
|
renderProduct(product) {
|
||||||
|
var product = product.product;
|
||||||
const main = document.getElementById('main');
|
const main = document.getElementById('main');
|
||||||
main.innerHTML = `
|
main.innerHTML = `
|
||||||
<h1>${product.name}</h1>
|
<h1>${product.name}</h1>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue