@mynewsdesk/promise-saga

1.1.2 • Public • Published

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(),
  ];
}

Dependencies (0)

    Dev Dependencies (23)

    Package Sidebar

    Install

    npm i @mynewsdesk/promise-saga

    Weekly Downloads

    3

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    2.72 kB

    Total Files

    2

    Last publish

    Collaborators

    • alexaivars
    • alexander.rothe
    • andreaszecher
    • danielschnee
    • guusli
    • joachimlindqvist
    • josuakoschwitz
    • katekolosova
    • marianaalberto
    • mynewsdesk-dev