import { makeAsyncReducer, makeAsyncActionCreator, composeReducers } from 'redux-toolbelt';
import { makeAsyncSaga } from 'redux-toolbelt-saga';
import { addVisitPatient, getVisitPatient, getLocations, getLocationsCnt } from './service';
// Actions
export const actions = {
getVisit: makeAsyncActionCreator('GET_QUESTIONNARIE'),
addVisit: makeAsyncActionCreator('CREATE_ADD_VISIT'),
getLocation: makeAsyncActionCreator('GET_LOCATIONS'),
getLocationCnt: makeAsyncActionCreator('GET_LOCATIONS')
};
// Reducer
export const reducer = composeReducers({
patient: makeAsyncReducer(actions.getVisit),
addpatient: makeAsyncReducer(actions.addVisit),
locations: makeAsyncReducer(actions.getLocation),
locationCnt: makeAsyncReducer(actions.getLocationCnt)
});
// Sagas
const PatientSaga = makeAsyncSaga(actions.getVisit, getVisitPatient, { debug: true });
const addPatientSaga = makeAsyncSaga(actions.addVisit, addVisitPatient, { debug: true });
const getLocationSaga = makeAsyncSaga(actions.getLocation, getLocations, { debug: true });
const getLocationCntSaga = makeAsyncSaga(actions.getLocationCnt, getLocationsCnt, { debug: true });
export const sagas = [
PatientSaga(),
addPatientSaga(),
getLocationSaga(),
getLocationCntSaga()
];
|