An axios like http client that uses fetch under the hood.
import { Conduit } from '@packages/conduit';
const conduit = Conduit.create({
baseURL: 'https://jsonplaceholder.typicode.com',
});
Conduit supports all the popular request methods.
const response = await conduit.get('/posts');
const posts = response.data;
const response = await conduit.post('/posts', {
title: 'foo',
body: 'bar',
userId: 1,
});
const post = response.data;
const response = await conduit.put('/post', {
id: 1,
title: 'foo',
body: 'bar',
userId: 1,
});
const response = await conduit.patch('/post', {
id: 1,
title: 'foo',
});
const response = await conduit.delete('/post', {
id: 1,
});