import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods'; const getSocialActions = () => fetchResults( '/api/1.0/person/social/social-action.json', { item_per_page: 200 } ); const getGoalByAction = (id) => { let url = `/api/1.0/person/social-work/goal/by-social-action/${id}.json`; return fetch(url) .then(response => { if (response.ok) { return response.json(); } throw Error('Error with request resource response'); }); }; const getResultByAction = (id) => { let url = `/api/1.0/person/social-work/result/by-social-action/${id}.json`; return fetch(url) .then(response => { if (response.ok) { return response.json(); } throw Error('Error with request resource response'); }); }; const getResultByGoal = (id) => { let url = `/api/1.0/person/social-work/result/by-goal/${id}.json`; return fetch(url) .then(response => { if (response.ok) { return response.json(); } throw Error('Error with request resource response'); }); }; export { getSocialActions, getGoalByAction, getResultByAction, getResultByGoal, }