const API_URL = process.env.NEXT_PUBLIC_API_URL;

export async function getCarDetailedRequest(carSlug: string) {
  const response = await fetch(`${API_URL}/car/${carSlug}`, {
    next: {
      revalidate: 3600,
    },
  });

  if (!response.ok) {
    throw new Error(`Failed to fetch the car ${carSlug} (${response.status})`);
  }

  return await response.json();
}
