// lib/api.ts

const API_URL = process.env.NEXT_PUBLIC_API_URL;

export async function apiFetch(endpoint: string) {
  const response = await fetch(`${API_URL}${endpoint}`);

  if (!response.ok) {
    throw new Error("Erreur API");
  }

  return response.json();
}