fetch.js 393 B

123456789101112131415161718
  1. import {
  2. call,
  3. put,
  4. } from 'redux-saga/effects';
  5. import { ReduxActionTypes } from '../../constants/actionTypes';
  6. import callApi from '../../apis';
  7. function* runClockSaga() {
  8. const data = yield call(callApi);
  9. if (data) {
  10. yield put({ type: ReduxActionTypes.FETCH_DATA_SUC });
  11. } else {
  12. yield put({ type: ReduxActionTypes.FETCH_DATA_FAL });
  13. }
  14. }
  15. export default runClockSaga;