7.0.0 • Published 1 year ago

fetch-json-timeout v7.0.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
1 year ago

fetch-json-timeout

Version 4

v4 is a major update that will break existing implementations. In particular, it returns a promise instead of an object when invoked:

import fetchJson from 'fetch-json-timeout';

const fetcher = await fetchJson();
const data = await fetcher('GET', url);

v4 also supports opinionated JWT token authentication, and refresh. Internally it keeps track of token expiery and refreshes it if it had expired.

import fetchJson from 'fetch-json-timeout';
const jwtOpts = {
  "uri":"https://some.api.endpoint/api/v3/tokens/login/",
  "refreshUri": "https://some.api.endpoint/api/v3/tokens/refresh/",
  "verb": "POST",
  "payload": {
    "email": "some.email@address.org",
    "password": "some_fancy_obscure_password"
  }
}

const fetcher = await fetchJson(undefined, undefined, jwtOpts);
const data = await fetcher('GET', url);
5.0.0

1 year ago

6.0.0

1 year ago

7.0.0

1 year ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.0

3 years ago

1.2.2

6 years ago

1.2.0

6 years ago

1.0.1

6 years ago

0.0.1

6 years ago