error.js 887 Bytes
Newer Older
1
import { query403, query401, query404, query500 } from '../services/error';
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

export default {
  namespace: 'error',

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

  effects: {
    *query403(_, { call, put }) {
      yield call(query403);
      yield put({
        type: 'trigger',
        payload: '403',
      });
    },
19 20 21 22 23 24 25
    *query401(_, { call, put }) {
      yield call(query401);
      yield put({
        type: 'trigger',
        payload: '401',
      });
    },
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
    *query500(_, { call, put }) {
      yield call(query500);
      yield put({
        type: 'trigger',
        payload: '500',
      });
    },
    *query404(_, { call, put }) {
      yield call(query404);
      yield put({
        type: 'trigger',
        payload: '404',
      });
    },
  },

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