Created
June 24, 2018 09:01
-
-
Save AndrejGajdos/665860d737649b9513365ac3787caf04 to your computer and use it in GitHub Desktop.
This file is part of project https://github.com/AndrejGajdos/auth-flow-spa-node-react
This file contains 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
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