Project

General

Profile

Actions

Feature #26729

closed

Add redux middleware for API calls

Added by Maria Agaphontzev about 5 years ago. Updated almost 4 years ago.


Description

https://community.theforeman.org/t/wip-proposal-refactoring-our-redux/11640
The goal is to create a new infrastructure for API communication that will make it easier to do API calls from redux controllers.
So we can create actions that will look like this:

  return {
    type: API_REQUEST,
    action: ACTIONS.GET,
    url: `/foreman_tasks/tasks/summary/${hours}`,
    subType: FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY,
    normalizeResponse: (data) => data.results[0],
    normalizeError: error => error.message,
    onError: error => console.log(error),
  }
Actions

Also available in: Atom PDF