Conversation
| const config = require("./webpack.config"); | ||
| const compiler = webpack(config); | ||
|
|
||
| const webpackDevMiddleware = require("webpack-dev-middleware")( |
There was a problem hiding this comment.
But why still you need it? Isn't it picking up automatically?
.env
Outdated
| @@ -0,0 +1,2 @@ | |||
| URL=http://localhost:3000 | |||
There was a problem hiding this comment.
Please replace it with BASE_DOMAIN. Also, there should be different env files for each env.
There was a problem hiding this comment.
done, targeting only dev right now.
.babelrc
Outdated
| "env", | ||
| { | ||
| "targets": { | ||
| "browsers": ["last 2 Chrome versions"] |
There was a problem hiding this comment.
Why only chrome versions? It should support other browser as well.
.babelrc
Outdated
| { | ||
| "presets": [ | ||
| [ | ||
| "env", |
src/main.js
Outdated
| @@ -0,0 +1,3 @@ | |||
| require("webpack-hot-middleware/client"); | |||
There was a problem hiding this comment.
I'm using webpack dev server. Both running on different port. Through this everything running on single port.
src/main.js
Outdated
| @@ -0,0 +1,3 @@ | |||
| require("webpack-hot-middleware/client"); | |||
| require("./main.scss"); | |||
There was a problem hiding this comment.
why do we need require? It should be import.
src/routes/api.js
Outdated
|
|
||
| const cartListData = { data: [] }; | ||
|
|
||
| products.forEach(function(product) { |
src/routes/api.js
Outdated
| router.post("/removeFromCart", function(req, res) { | ||
| const index = cart.indexOf(req.body.productId); | ||
| if (index !== -1) cart.splice(index, 1); | ||
| addToCart.cart = cart.length; |
There was a problem hiding this comment.
is there a reason to use cart.length?
There was a problem hiding this comment.
yeah, checking no of items.
src/js/controller/cart/cart.js
Outdated
| try { | ||
| const cart = await addToCarts(productId); | ||
| // render result on UI | ||
| CART_SELECTOR.cartItem.textContent = cart.cart + " items"; |
There was a problem hiding this comment.
can we use more descriptive name then cart.cart?
#[email protected]
#[email protected]