fix
This commit is contained in:
parent
cf5462b901
commit
6ae1d3740c
@ -203,24 +203,26 @@ class Main extends Component {
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
selectDeliveryCallback(point){
|
selectDeliveryCallback(point){
|
||||||
fetch(addr_prefix + '/api/cart/select_delivery?delivery='+point.name).then(resp => resp.json()).then(json => {
|
if(point){
|
||||||
if(json.status == "failed"){
|
fetch(addr_prefix + '/api/cart/select_delivery?delivery='+point.name).then(resp => resp.json()).then(json => {
|
||||||
this.setState({
|
if(json.status == "failed"){
|
||||||
status_text: json.reason,
|
this.setState({
|
||||||
status: "failed",
|
status_text: json.reason,
|
||||||
})
|
status: "failed",
|
||||||
}else{
|
})
|
||||||
this.setState({
|
}else{
|
||||||
cart: [
|
this.setState({
|
||||||
...this.state.cart.filter(product => !product.name.startsWith("Doprava na ")),
|
cart: [
|
||||||
{"name": "Doprava na " + point.name, "id": 2, "price": delivery_cost, "locked": true, "quantity": 1}
|
...this.state.cart.filter(product => !product.name.startsWith("Doprava na ")),
|
||||||
],
|
{"name": "Doprava na " + point.name, "id": 2, "price": delivery_cost, "locked": true, "quantity": 1}
|
||||||
delivery: point.name,
|
],
|
||||||
status_text: json.reason,
|
delivery: point.name,
|
||||||
status: "success",
|
status_text: json.reason,
|
||||||
})
|
status: "success",
|
||||||
}
|
})
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
selectDelivery = () => {
|
selectDelivery = () => {
|
||||||
Packeta.Widget.pick("8599115769fd895b", this.selectDeliveryCallback.bind(this))
|
Packeta.Widget.pick("8599115769fd895b", this.selectDeliveryCallback.bind(this))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user