Skip to content

Conversation

@hamzah-kurdi
Copy link

majority of tasks completed including GET, POST, DELETE fetch requests. Added a review page to home screen also using REST API. Had a lot of fun on this project 😎


app.post("/api/messages", function(req, res) {
console.log(req.body);
let messageID = `Message${messID}`;
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 just use the messID as id rather than prepend Message string to it

});

app.delete("/api/orders/:id", (req, res) => {
delete orders[req.params.id];
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

total = Math.floor(total + newOrder[key].ownTotal);
}
}
total += 2.4;
Copy link
Contributor

Choose a reason for hiding this comment

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

The order charge would better off being defined in a variable. This was it will be clearer what 2.4 refers to for someone who is not familiar with the code since the variable name will provide a hint

.then(data => {
console.log("handleClick");

self.props.receiveUpdateOrder(data);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use this here instead of self since it is an arrow function

};
console.log(result);
if (
this.state.newMess.length > 0 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect the entire condition can be rewritten as if(this.state.newMess.length && this.state.newAuthor.length). If it's a string it will have the length property and we can take advantage of the fact that if length is greater than zero, it will be truthy

}

render() {
setTimeout(() => console.log("Hello"), 4000);
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 needed?

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