| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import { queryActivities } from '../services/api';
- export default {
- namespace: 'activities',
- state: {
- list: [],
- loading: true,
- },
- effects: {
- *fetchList(_, { call, put }) {
- yield put({
- type: 'changeLoading',
- payload: true,
- });
- const response = yield call(queryActivities);
- yield put({
- type: 'saveList',
- payload: response,
- });
- yield put({
- type: 'changeLoading',
- payload: false,
- });
- },
- },
- reducers: {
- saveList(state, action) {
- return {
- ...state,
- list: action.payload,
- };
- },
- changeLoading(state, action) {
- return {
- ...state,
- loading: action.payload,
- };
- },
- },
- };
|