"use client"; import { useState, useEffect } from "react"; import axios from "axios"; import DocumentItem from "./DocumentItem"; import { Document } from "./types"; export default function ExplorePage() { const [documents, setDocuments] = useState([]); useEffect(() => { fetchDocuments(); }, []); const fetchDocuments = async () => { try { console.log( `Fetching documents from ${process.env.NEXT_PUBLIC_BACKEND_URL}/explore` ); const response = await axios.get<{ documents: Document[] }>( `${process.env.NEXT_PUBLIC_BACKEND_URL}/explore` ); setDocuments(response.data.documents); } catch (error) { console.error("Error fetching documents", error); setDocuments([]); } }; return (

Explore Files

{documents.map((document, index) => ( ))}
); }