1.0.7 • Published 5 years ago

multiple-fetch v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

multiple-fetch

npm bundle size npm npm type definitions npm

Make multiple fetch requests and structurize responses.

Installation

# pnpm / npm
pnpm i multiple-fetch isomorhpic-unfetch
# yarn
yarn add multiple-fetch isomorhpic-unfetch

Example

import 'isomorhpic-unfetch'
import multiFetch from 'multifetch'

const urls = ['todos', 'comments']

const results = await multiFetch(
  urls,
  {
    method: 'GET',
    headers: {
      token: 'lol'
    }
  },
  { parse: 'json', domain: 'https://jsonplaceholder.typicode.com/' }
)

console.log(results)

/*

{
  "results": {
    "todos": [...]
  },
  "errors: [{
    "response": {
      status: 404,
      ...
    }
    "url: "https://jsonplaceholder.typicode.com/comments"
  }],
  "serverErrors": []
}

*/
1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago