fix
This commit is contained in:
parent
01c5957bab
commit
01f3bfcb2a
@ -31,6 +31,7 @@ class Main extends Component {
|
||||
currentImage: 0,
|
||||
uploadProgress: 0.0,
|
||||
login_status: {},
|
||||
cart: [],
|
||||
};
|
||||
fetch(addr_prefix + "/api/results").then(resp => resp.json()).then(json => {
|
||||
this.setState({results: json})
|
||||
@ -78,6 +79,11 @@ class Main extends Component {
|
||||
showRacerModalWindow: true,
|
||||
})
|
||||
}
|
||||
addToCart = (id) =>{
|
||||
this.setState({
|
||||
cart: [...this.state.cart, id]
|
||||
});
|
||||
}
|
||||
onSubmit(event){
|
||||
event.preventDefault();
|
||||
let form = document.getElementById("form");
|
||||
@ -232,7 +238,7 @@ class Main extends Component {
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{product.name}</h5>
|
||||
<p class="card-text">{product.description}</p>
|
||||
<a href="#" onClick={(e) => e.preventDefault()} class="btn btn-primary">Přidat do košíku</a>
|
||||
{product.price} Kč <a href="#" onClick={(e) => {e.preventDefault();this.addToCart(product.id)}} class="btn btn-primary">Přidat do košíku</a>
|
||||
</div>
|
||||
</div>)}
|
||||
</div>}
|
||||
|
Loading…
x
Reference in New Issue
Block a user