UNPKG

ruins

Version:

> [!IMPORTANT] > This is in beta. Not everything is ironed out and some modules might misbehave

9 lines (6 loc) 235 B
const baseUrl = "http://localhost:3000/api"; export const fetchy = async <T>(url): Promise<T | { data: false }> => { const res = await fetch(baseUrl + url); if (res.status === 204) return { data: false }; return res.json(); };