@genee/fetch
v1.7.0
Published
## Usage
Downloads
48
Readme
@genee/fetch
Usage
import fetch from '@genee/fetch';
type UserData = {
id: number;
name: string;
};
(async () => {
const user = await fetch<UserData>('path/to/user', {
method: 'POST',
body: {
name: 'Doe John',
},
// timeout: 5000, // default is 5000
// json: true, // default is true, return original text if json is false
beforeRequest(url, init) {
},
customParser(r: Response, defaultParser: (r: Response) => any) {
return defaultParser(r);
},
});
})();