Last active
April 30, 2019 11:48
-
-
Save sharvit/915decb9a3599ed1161097f4ee988fd3 to your computer and use it in GitHub Desktop.
API request action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const fetchTasksSummary = time => { | |
const hours = timeToHoursNumber(time); | |
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), | |
} | |
}; | |
// another option | |
export const fetchTasksSummary = time => { | |
const hours = timeToHoursNumber(time); | |
return ActionsAPI.get({ | |
url: `/foreman_tasks/tasks/summary/${hours}`, | |
type: FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY, | |
normalizeResponse: (data) => data.results[0], | |
normalizeError: error => error.message, | |
onError: error => console.log(error), | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment