i have many problem with this. see README#4
i have many problem with this. see README#4Ethanng329 wants to merge 36 commits intoconstructorlabs:masterfrom
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.
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.
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.
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.
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.
Is this import needed?
src/components/App.js
Outdated
| import React from 'react'; | ||
| import Header from './Header'; | ||
| import Menu from './Menu'; | ||
| // import Basket from './Basket'; |
There was a problem hiding this comment.
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); |
src/components/App.js
Outdated
| } | ||
|
|
||
| handleClick(event) { | ||
| // event.preventDefault() |
There was a problem hiding this comment.
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.
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.
Is this import needed?
|
|
||
| // dfads@asfdsd.com | ||
|
|
||
| const chunks = email.split('@'); |
There was a problem hiding this comment.
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.
Commented out code can be removed
| @@ -0,0 +1,16 @@ | |||
| <!DOCTYPE html> | |||
There was a problem hiding this comment.
I would recommend naming this file using lower case
No description provided.