Closed rcalabro closed 7 years ago
Solved using redux-form action creators in my authSaga
import { put, call } from 'redux-saga/effects';
import { takeLatest } from 'redux-saga';
import { token } from 'services/api/auth';
import { stopSubmit, setSubmitSucceeded, setSubmitFailed } from 'redux-form/lib/actions';
import * as actions from './actions';
const { auth } = actions.sagaActions;
function* authSaga(action) {
yield put(auth.request());
const { data, error } = yield call(token, action.payload);
if (data) {
yield put(stopSubmit('signinForm'));
yield put(auth.success(data));
yield put(setSubmitSucceeded('signinForm'));
} else {
yield put(stopSubmit('signinForm', { _error: error.message }));
yield put(auth.failure(error));
yield put(setSubmitFailed('signinForm'));
}
}
export function* watchAuth() {
yield* takeLatest(actions.SIGNIN_SUBMIT, authSaga);
}
export default {
watchAuth
};
Hi,
I trying this lib and it is working just fine, except for this issue.
After my saga runs, STOP_SUBMIT is not dispatched by the form.
This is my saga:
and this is my form:
Am I using it wrong?
Thanks