import { query } from '@pages/{{{ COMPONENT_NAME }}}/services/index';

const {{{ COMPONENT_NAME }}}Model = {
  namespace: '{{{ NAME }}}',
  state: {
    name: '',
  },

  effects: {
    *query({ payload }, { call, put }) {
      const data = yield call(query, payload);
      yield put({
        type: 'save',
        payload: { name: data.text },
      });
    },
  },
  reducers: {
    save(state, { payload }) {
      return { ...state, ...payload };
    },
  },
};

export default {{{ COMPONENT_NAME }}}Model;
