basir / react-shopping-cart

React Redux Tutorial - Build ECommerce Shopping Cart In 5 Hours
https://react-shopping-cart-final.herokuapp.com/
210 stars 201 forks source link

Product isn't displaying!!! #19

Open ashiqchinju opened 4 years ago

ashiqchinju commented 4 years ago

"Uncaught (in promise) TypeError: NetworkError when attempting to fetch resource." at productAction.js : 7

export const fetchProducts = () => async (dispatch) => {
  const res = await fetch("/api/products");
  const data = await res.json();
  console.log(data);
  dispatch({
    type: FETCH_PRODUCTS,
    payload: data,
  });
};

please help me with this!!

brianwilsonotweyo commented 4 years ago

use cors in the server and then for the res in ptoductaction use "http://localhost:5000/api/products: