12 lines
288 B
TypeScript
12 lines
288 B
TypeScript
export const API_BASE_URL = 'http://127.0.0.1:3000';
|
|
|
|
export async function fetchApi(endpoint: string) {
|
|
const res = await fetch(`${API_BASE_URL}${endpoint}`, {
|
|
cache: 'no-store',
|
|
});
|
|
if (!res.ok) {
|
|
throw new Error(`Failed to fetch ${endpoint}`);
|
|
}
|
|
return res.json();
|
|
}
|