aboutsummaryrefslogtreecommitdiff
path: root/src/lib/api.ts
blob: 160e3089f29211f879712c6f8e282ceb1937a1a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
const base = 'http://localhost:6969'

export async function api(method: string, resource: string, data?: any) {
    return await fetch(`${base}/${resource}`, {
	    method,
	    headers: {
	        'content-type': 'application/json'
	    },
	    body: data
    });
}