Skip to content

Commit

Permalink
Navigating to the Checkout Page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ch-sriram committed Aug 14, 2020
1 parent c1fed9a commit 0b4e6a4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ Firebase Common API Endpoint: <https://burger-builder-ram.firebaseio.com/>

1. Building the `<Checkout />` & `<CheckoutSummary />` Components: [Commit Details](https://github.com/Ch-sriram/burger-builder/commit/bb4ab26d36667835423c08ca13c66db4be548c82)
2. Setting Up Routing & Routes **`npm i --save react-router-dom`**: [Commit Details](https://github.com/Ch-sriram/burger-builder/commit/3c6460117d6ea628539b3f21b93c8cefdf8c16ff)
3. Navigating to the Checkout Page: [Commit Details]()
52 changes: 27 additions & 25 deletions src/containers/BurgerBuilder/BurgerBuilder.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,33 @@ class BurgerBuilder extends Component {
};

orderContinueHandler = () => {
this.setState({ loading: true }, () => {
const order = {
ingredients: this.state.ingredients,
price: this.state.totalPrice,
customer: {
name: "Ch. Sriram",
address: {
street: "Crazy Street",
zipCode: "51251",
country: "Zambia",
},
email: "test@crazy.com",
deliveryMethod: "fastest",
},
};

axios
.post("/orders.json", order)
.then((response) => {
this.setState({ loading: false, orderNow: false });
})
.catch((error) => {
this.setState({ loading: false, orderNow: false });
});
});
// this.setState({ loading: true }, () => {
// const order = {
// ingredients: this.state.ingredients,
// price: this.state.totalPrice,
// customer: {
// name: "Ch. Sriram",
// address: {
// street: "Crazy Street",
// zipCode: "51251",
// country: "Zambia",
// },
// email: "test@crazy.com",
// deliveryMethod: "fastest",
// },
// };

// axios
// .post("/orders.json", order)
// .then((response) => {
// this.setState({ loading: false, orderNow: false });
// })
// .catch((error) => {
// this.setState({ loading: false, orderNow: false });
// });
// });
console.log(this.props);
this.props.history.push("/checkout");
};

render() {
Expand Down

0 comments on commit 0b4e6a4

Please sign in to comment.