Skip to content

Instantly share code, notes, and snippets.

@AndrejGajdos
Created June 24, 2018 09:01
Show Gist options
  • Save AndrejGajdos/665860d737649b9513365ac3787caf04 to your computer and use it in GitHub Desktop.
Save AndrejGajdos/665860d737649b9513365ac3787caf04 to your computer and use it in GitHub Desktop.
import { put, takeLatest } from 'redux-saga/effects';
import * as ActionTypes from 'constants/actionTypes';
function* toggleModal(action) {
const { newState } = action;
if (!newState) {
// if login modal is closed, reset error
yield put({ type: ActionTypes.LOGIN_FAILED, error: null });
}
yield put({ type: ActionTypes.TOGGLE_MODAL_SUCCEEDED, newState });
}
export default function* watchToggleModal() {
yield takeLatest(ActionTypes.TOGGLE_MODAL_REQUESTED, toggleModal);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment