Files
wagmi-lesson/app/lib/fetch.ts
T
2026-09-17 00:34:19 +02: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();
};