I'm trying to fetch my data from a heroku app into Redux, but I think I'm running into a CORS issue. I've been playing with "headers" for a while and still can't figure it out.
This is the exact error: "Failed to load https://name-app.herokuapp.com/users: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."
And this is my code:
 export function fetchMicros() {
  return dispatch => {
    const url = "https://name-app.herokuapp.com/users";
      return fetch(url, {
       method: 'GET',
       mode: 'cors',
       headers: { 'Content-Type': 'text' },
     })
     .then(handleErrors)
     .then(res => res.json())
     .then(micros => {
        dispatch(fetchVitamins(micros));
     }
   )};
};
 
    