Skip to main content

@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