import { fakeRegister } from '../services/api'; export default { namespace: 'register', state: { status: undefined, }, effects: { *submit(_, { call, put }) { yield put({ type: 'changeSubmitting', payload: true, }); const response = yield call(fakeRegister); yield put({ type: 'registerHandle', payload: response, }); yield put({ type: 'changeSubmitting', payload: false, }); }, }, reducers: { registerHandle(state, { payload }) { return { ...state, status: payload.status, }; }, changeSubmitting(state, { payload }) { return { ...state, submitting: payload, }; }, }, };