1.0.6 • Published 2 years ago
chad-fetch v1.0.6
Chad Fetch
A tiny version of fetch for the browser (not a pollyfill)
Installation
npm install chad-fetch
Usage
import fetch from 'chad-fetch'
// fetch.get(url, queryParams?) returns T
fetch
.get<T>('https://rickandmortyapi.com/api/character', { page: 1 })
.then(res => console.log(res))
// fetch.post(url, data) returns T | only uploads objects
fetch
.post<T>('https://jsonplaceholder.typicode.com/posts', {
title: 'foo',
body: 'bar',
userId: 1,
})
.then(res => console.log(res))