Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

still in progress #19

wants to merge 5 commits into from

Conversation

jay9044
Copy link

@jay9044 jay9044 commented Oct 16, 2018

still have a lot of things to finish

@@ -0,0 +1,98 @@
function menu(){

const menuClosure = {
Copy link
Contributor

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 = {
Copy link
Contributor

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){
Copy link
Contributor

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()
Copy link
Contributor

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({
Copy link
Contributor

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?

Copy link
Contributor

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]
Copy link
Contributor

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
Copy link
Contributor

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'
Copy link
Contributor

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(){
Copy link
Contributor

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

@dmitrigrabov
Copy link
Contributor

Good work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants