import { fakeAccountLogin, fakeMobileLogin } from '../services/api'; export default { namespace: 'login', state: { status: undefined, }, effects: { *accountSubmit({ payload }, { call, put }) { yield put({ type: 'changeSubmitting', payload: true, }); const response = yield call(fakeAccountLogin, payload); yield put({ type: 'loginHandle', payload: response, }); yield put({ type: 'changeSubmitting', payload: false, }); }, *mobileSubmit({ payload }, { call, put }) { yield put({ type: 'changeSubmitting', payload: true, }); const response = yield call(fakeMobileLogin); yield put({ type: 'loginHandle', payload: response, }); yield put({ type: 'changeSubmitting', payload: false, }); }, }, reducers: { loginHandle(state, { payload }) { return { ...state, status: payload.status, type: payload.type, }; }, changeSubmitting(state, { payload }) { return { ...state, submitting: payload, }; }, }, };