error.js 441 Bytes
Newer Older
1
import { query } from '../services/error';
2 3 4 5 6 7 8 9 10 11

export default {
  namespace: 'error',

  state: {
    error: '',
    isloading: false,
  },

  effects: {
12 13
    *query({ payload }, { call, put }) {
      yield call(query, payload.code);
14 15
      yield put({
        type: 'trigger',
16
        payload: payload.code,
17 18 19 20 21 22 23 24 25 26 27 28
      });
    },
  },

  reducers: {
    trigger(state, action) {
      return {
        error: action.payload,
      };
    },
  },
};