model.js 507 Bytes
import { fakeRegister } from './service';

export default {
  namespace: 'BLOCK_NAME_CAMEL_CASE_CAMEL_CASE',

  state: {
    status: undefined,
  },

  effects: {
    *submit({ payload }, { call, put }) {
      const response = yield call(fakeRegister, payload);
      yield put({
        type: 'registerHandle',
        payload: response,
      });
    },
  },

  reducers: {
    registerHandle(state, { payload }) {
      return {
        ...state,
        status: payload.status,
      };
    },
  },
};