Conversation
| @@ -0,0 +1,98 @@ | |||
| function menu(){ | |||
|
|
|||
| const menuClosure = { | |||
There was a problem hiding this comment.
I wouldn't call the object a closure, because a closure is a combination of an outer function and inner function which retains access to parent scope. Here we are just storing some data so something like menuData would be more appropriate
|
|
||
|
|
||
|
|
||
| module.exports = { |
There was a problem hiding this comment.
Great to see closures in use :)
| res.json(allOrders) | ||
| }) | ||
|
|
||
| app.get('/order:orderId', function(req,res){ |
There was a problem hiding this comment.
There should probably be a slash after /order
| }) | ||
|
|
||
| app.get('/order:orderId', function(req,res){ | ||
| const specificOrder = getOrder() |
There was a problem hiding this comment.
Get order needs to receive an order id to work
| } | ||
|
|
||
| sendOrder(){ | ||
| this.setState({ |
There was a problem hiding this comment.
Does sendOrder not send data to server?
There was a problem hiding this comment.
Just saw that the order gets sent from Basket. It might better to do fetch and clear data in one go so that you only clear order data once you know that the API request has been successful
| }); | ||
| } else { | ||
| this.setState({ | ||
| order: [...this.state.order, order] |
There was a problem hiding this comment.
Order is initialised to be an object, but here an array gets assigned
| const showOrder = this.props.order | ||
| this.setState({ | ||
| showOrder: showOrder, | ||
| button: showOrder ? true : false |
There was a problem hiding this comment.
I think this line is not necessary as it duplicates value stored in showOrder. You can use this.state.showOrder to determine whether to display show order button in render method
| @@ -0,0 +1,26 @@ | |||
| // import React from 'react' | |||
There was a problem hiding this comment.
This component can be deleted as all code is commented out
| }) | ||
| } | ||
|
|
||
| MakeOrder(){ |
There was a problem hiding this comment.
method name should start with lower case letter
|
Good work |
still have a lot of things to finish