Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. export function* submitSettingsSaga(action) {
  2. yield put(actions.submitSettingsStart());
  3. try {
  4. const response = yield axios.patch(`/useCases/${action.useCaseId}.json`, action.data);
  5. yield put(actions.submitSettingsSuccess(response.data));
  6. try {
  7. const response = yield axios.get('/useCases.json');
  8. const fetchedData = [];
  9. for (let key in response.data) {
  10. fetchedData.push({
  11. ...response.data[key],
  12. id: key
  13. });
  14. }
  15. yield put(actions.fetchUseCaseDataSuccess(fetchedData));
  16. } catch (error) {
  17. yield put(actions.fetchUseCaseDataFailed(error));
  18. }
  19. } catch (error) {
  20. yield put(actions.submitSettingsFail(error))
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement