Skip to content

Conversation

@KateMhq
Copy link

@KateMhq KateMhq commented Oct 15, 2018

No description provided.

.map(eachOrder => eachOrder.price * eachOrder.number)
.reduce((acc, item) => acc + item);
const deliveryCost = foodCost * 0.1;
const totalCost = foodCost * 1.1;
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 be better to use totalCost = foodCost + deliveryCost to prevent logic duplication

@@ -0,0 +1,93 @@
function database() {
Copy link
Contributor

Choose a reason for hiding this comment

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

very nice

placedOrders: body
},
() =>
localStorage.setItem(
Copy link
Contributor

Choose a reason for hiding this comment

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

Since placedOrders are stored on the server, I would suggest not storing them locally as well. Otherwise we end up with 2 sources of truth. It would better to fetch the data from the server when needed

return item;
}
})
.filter(item => item.number !== 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

menu: [],
order: [],
placedOrders: [],
orderBasket: [],
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like orderBasket is not used and can probably be removed

@dmitrigrabov
Copy link
Contributor

Great work. I would suggest not using localStorage to store data which is also stored on server to avoid duplication. Just store everything on server and get it from there

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