-
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
i have many problem with this. see README #4
base: master
Are you sure you want to change the base?
Conversation
index.js
Outdated
orders[index] = req.body; | ||
orders[index]['id'] = index; | ||
orderid++; | ||
res.status(200).json({ OK: 'order completed' }); |
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.
It would be good to return the new object after save with new id
res.json(orders); | ||
}); | ||
|
||
// app.post('/menu', 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.
Commented out code can be removed
index.js
Outdated
res.status(200).json({ OK: 'order completed' }); | ||
}); | ||
|
||
app.get('/api/order', 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.
It could be better to call the route /api/orders
as it returns multiple orders rather than a single order
src/components/App.js
Outdated
completeOrder: complete | ||
}); | ||
|
||
fetch('http://localhost:8080/api/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.
Use relative URL here - /api/order
. It will also make the CORS issue go away
import Header from './Header'; | ||
import Menu from './Menu'; | ||
// import Basket from './Basket'; | ||
import { METHODS } from 'http'; |
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.
Is this import needed?
src/components/App.js
Outdated
@@ -1,16 +1,146 @@ | |||
import React from 'react'; | |||
import Header from './Header'; | |||
import Menu from './Menu'; | |||
// import Basket from './Basket'; |
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.
Commented code can be removed
const currentOrder = Object.assign({}, this.state.currentOrder, newOrder); | ||
this.setState({ currentOrder }); | ||
} else if ((this.state.currentOrder[id] = 1)) { | ||
const currentOrder = Object.assign({}, this.state.currentOrder); |
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.
nice
src/components/App.js
Outdated
} | ||
|
||
handleClick(event) { | ||
// event.preventDefault() |
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.
Commented out code can be removed
@@ -0,0 +1,13 @@ | |||
import React from 'react'; | |||
import { INSPECT_MAX_BYTES } from 'buffer'; |
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.
Is this import needed?
@@ -0,0 +1,37 @@ | |||
import React from 'react'; | |||
import { ENGINE_METHOD_DIGESTS } from 'constants'; |
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.
Is this import needed?
|
||
// [email protected] | ||
|
||
const chunks = email.split('@'); |
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.
It would be neat to extrac email validation function into own module. let me know if you need any help with that
receiver={this.receiver} | ||
value={this.state.email} | ||
/> | ||
{/* <button type="submit">Submit</button> */} |
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.
Commented out code can be removed
@@ -0,0 +1,16 @@ | |||
<!DOCTYPE html> |
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 would recommend naming this file using lower case
No description provided.