import { useEffect, useState } from "react";
import { getColles } from "~/lib/api";

export default function Index() {
  const [colles, setColles] = useState([]);

  useEffect(() => {
    // Fetch colles data from the API
    getColles(12, 2025).then((data) => {
      setColles(data);
    }).catch((error) => {
      console.error("Error fetching colles:", error);
    });
  }, []);

  return (
    <div className="flex items-center justify-center h-screen">
      <div className="flex flex-col items-center space-y-4">
        <h1 className="text-2xl font-bold">Welcome to Khollisé!</h1>
        <p>Got {colles.length} colles this week.</p>
      </div>
    </div>
  );
}
