function fetchExercises(workoutId) {
  return function(dispatch) {
    dispatch({type: 'LOADING_EXERCISES'})
    return fetch(`/api/workouts/${workoutId}/exercises`)
      .then(resp => resp.json())
      // Dispatches JSON response containing exercises to store
      .then(exercises => dispatch({type: 'FETCH_EXERCISES', payload: exercises}))
  }
}
// Retrieves exercises nested index resource from Rails API
Retrieves exercises nested index resource from Rails API
Retrieves exercises nested index resource from Rails API
function fetchExercises(workoutId) {
  return function(dispatch) {
    dispatch({type: 'LOADING_EXERCISES'})
    return fetch(`/api/workouts/${workoutId}/exercises`)
      .then(resp => resp.json())
      .then(exercises => dispatch({type: 'FETCH_EXERCISES', payload: exercises}))
  }
}
function fetchExercises ( workoutId ) { return function ( dispatch ) { dispatch ( { type : 'LOADING_EXERCISES' } ) return fetch ( ` ${ workoutId } ` ) . then ( resp => resp . json ( ) ) . then ( exercises => dispatch ( { type : 'FETCH_EXERCISES' , payload : exercises } ) ) } }
Retrieves exercises nested index resource from Rails API
Retrieves exercises nested index resource from Rails API
// Dispatches JSON response containing exercises to store