1.1.2 • Published 4 years ago

@mynewsdesk/promise-saga v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

PromiseSaga

Util function to return promise results as redux actions

Releasing

  • use lerna publish in the parent folder

Testing

  • to run the tests use:
yarn test
  • to rerun test when saving run:
yarn test --watch
  • coverage reports can be shown with:
yarn coverage

Documentation

import { take, actionChannel } from 'redux-saga/effects';
import createPromiseSaga from '@mynewsdesk/promise-saga';

function* watchFetchUrl() {
  const channel = yield actionChannel('FETCH_URL');
  while (true) {
    const action = yield take(channel);
    const { url } = action.payload;
    yield* createPromiseSaga(
      action,
      fetch,
      url
    )();
  }
}

export default function* sagas() {
  yield [
    watchFetchUrl(),
  ];
}
1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

6 years ago

1.0.0

6 years ago