Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 815 Bytes

README.md

File metadata and controls

51 lines (37 loc) · 815 Bytes

@gasket/fetch

Gasket will utilize the Fetch API as our standard request library. This package serves as a proxy for fetch implementations with server-side support.

Installation

npm i @gasket/fetch

Usage

Example with promises

import fetch from '@gasket/fetch';

fetch('url/to/resource')
  .then(res => {
    if (res.ok) {
      // handle success
    } else {
      // handle error
    }
  });

Example with async/await

import fetch from '@gasket/fetch';

const getSomething = async () => {
  const res = await fetch('url/to/resource');
  if (res.ok) {
    // handle success
  } else {
    // handle error
  }
};

Reference

License

MIT