@regenerate/effect-fetch

1.0.2 • Public • Published

@regenerate/effect-fetch

Regenerate effect to use fetch-like requests

Installation

# Using yarn
yarn add @regenerate/effect-fetch

# Using npm
npm i @regenerate/effect-fetch

Set up

Create a src/effects/http.js file in your project with the following content:

import createFetchEffect from '@regenerate/effect-fetch'

// You can use any module that is compliant with the fetch API
import fetch from 'isomorphic-unfetch'

export default createFetchEffect({ fetch })

Usage

It can be used like the fetch API

function * fetchTodos () {
  const todos = yield http.fetchJson(
    'http://api.url/todos',
    {
      method: 'GET'
      /* fetch options */
    }
  )
  // Rest of effects
}

Readme

Keywords

none

Package Sidebar

Install

npm i @regenerate/effect-fetch

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

4.22 kB

Total Files

6

Last publish

Collaborators

  • mrmsanchez
  • d_asensio