Skip to content

Conversation

@Ethanng329
Copy link

No description provided.

index.js Outdated
orders[index] = req.body;
orders[index]['id'] = index;
orderid++;
res.status(200).json({ OK: 'order completed' });
Copy link
Contributor

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

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

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

completeOrder: complete
});

fetch('http://localhost:8080/api/order', {
Copy link
Contributor

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this import needed?

import React from 'react';
import Header from './Header';
import Menu from './Menu';
// import Basket from './Basket';
Copy link
Contributor

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

}

handleClick(event) {
// event.preventDefault()
Copy link
Contributor

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this import needed?


// dfads@asfdsd.com

const chunks = email.split('@');
Copy link
Contributor

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> */}
Copy link
Contributor

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

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

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