Guest User

Untitled

a guest
Jan 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. function* updateSomethingFlow(action) {
  2. try {
  3. const response = yield call(updateSomething, action.payload);
  4. if (response) {
  5. yield put({
  6. type: UPDATE_SUCCESS
  7. });
  8. }
  9. } catch (err) {
  10. yield put({
  11. type: UPDATE_FAILURE,
  12. payload: prepareErrorMessages(err, 'Failed to update. Please, try again.')
  13. });
  14. }
  15. }
  16.  
  17. case UPDATE_FAILURE:
  18. nextState = {
  19. ...state,
  20. loading: false,
  21. errors: prepareErrorMessages(payload, 'Failed to update. Please, try again.'),
  22. };
  23. break;
Add Comment
Please, Sign In to add comment