-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
still in progress #19
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,98 @@ | |||
function menu(){ | |||
|
|||
const menuClosure = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see closures in use :)
res.json(allOrders) | ||
}) | ||
|
||
app.get('/order:orderId', function(req,res){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get order needs to receive an order id to work
} | ||
|
||
sendOrder(){ | ||
this.setState({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does sendOrder
not send data to server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This component can be deleted as all code is commented out
}) | ||
} | ||
|
||
MakeOrder(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method name should start with lower case letter
Good work |
still have a lot of things to finish