component: post order data to endpoint by axios instance
This commit is contained in:
parent
e5bdacd59a
commit
8dc0188ed1
@ -5,6 +5,7 @@ import Burger from '../../components/Burger/Burger';
|
||||
import BuildControls from '../../components/Burger/BuildControls/BuildControls';
|
||||
import Modal from '../../components/UI/Modal/Modal';
|
||||
import OrderSummary from '../../components/Burger/OrderSummary/OrderSummary';
|
||||
import axios from '../../axios-orders';
|
||||
|
||||
const INGREDIENT_PRICE = {
|
||||
salad: 0.4,
|
||||
@ -87,7 +88,23 @@ class BurgerBuilder extends Component {
|
||||
}
|
||||
|
||||
purchaseContinueHandler = () => {
|
||||
alert("You continue");
|
||||
const order = {
|
||||
ingredients: this.state.ingredients,
|
||||
price: this.state.totalPrice,
|
||||
customer: {
|
||||
address: {
|
||||
country: "NEW ZEALAND",
|
||||
street: "test street 1",
|
||||
zipCode: "8042",
|
||||
},
|
||||
email: "test@test.com",
|
||||
name: "oscar",
|
||||
}
|
||||
};
|
||||
|
||||
axios.post('/order.json', order)
|
||||
.then(response => console.log(response))
|
||||
.catch(error => console.log(error));
|
||||
}
|
||||
|
||||
render() {
|
||||
|
Loading…
Reference in New Issue
Block a user