import 'whatwg-fetch'
import { API_URL, API_KEY } from '../config'
import types from '../constants/actionTypes'

const fetchMoviesByGenre = (genreId) => {
  const apiUrl = API_URL
  const apiKey = API_KEY

  let api_endpoint = `${apiUrl}/genre/${genreId}/movies?api_key=${apiKey}&language=en-US`

  return {
    type: types.FETCH_MOVIES,
    payload: new Promise((resolve, reject) => {
      fetch(api_endpoint)
        .then(r => resolve(r.json()))
        .catch(err => reject(err))
    })
  }
}

export { fetchMoviesByGenre }
@@ -404,25 +404,16 @@
 ndpoint)
-%0A        
 .then(r 
@@ -437,42 +437,21 @@
 ()))
-%0A        .catch(err =%3E 
+.catch(
 reject
-(err)
 )%0A  
@@ -491,8 +491,9 @@
 yGenre %7D
+%0A

Update movies.js