Files
wagmi-starter/app/lib/fetch.ts
2026-03-09 23:42:42 +01:00

8 lines
237 B
TypeScript

export const fetchApi = async <T = any>(url: string): Promise<T> => {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
};