aboutsummaryrefslogtreecommitdiff
path: root/src/requests.ts
blob: 486502d06d6951474d3a95535bb4a79013a72cd8 (plain)
1
2
3
4
5
6
7
8
9
10
import axios, { AxiosResponse } from 'axios';

type Request = (url: string, data?: Record<string, unknown>) => Promise<AxiosResponse>;

const baseApiUrl = 'http://localhost:3030';

export const get: Request = url => axios.get(baseApiUrl + url);
export const del: Request = url => axios.delete(baseApiUrl + url);
export const post: Request = (url, data) => axios.post(baseApiUrl + url, data);