interface Project { id: string; created_at: number; // ... autres propriétés } async function getProjects() { const baseUrl = process.env.BACKEND_URL; if (!baseUrl) { throw new Error("Variable d'environnement BACKEND_URL manquante"); } const res = await fetch(`${baseUrl}/projects/`, { cache: "no-store", }); if(!res.ok){ throw new Error("Erreur lors de la récupération des projets depuis l'API"); } return res.json(); } function toTags(technologies: unknown): string[] { if (Array.isArray(technologies)) return technologies.filter(Boolean).map(String); if (typeof technologies === 'string') { // Split on common separators and the word 'et' (French 'and') return technologies .split(/,|;|\||\//g) .flatMap(part => part.split(/\bet\b/i)) .flatMap(part => part.split(/\s{2,}/)) .map(s => s.trim()) .filter(s => s.length > 0); } return []; } function normalizeImageUrl(img: unknown): string | null { if (typeof img !== 'string' || img.trim() === '') return null; const val = img.trim(); // If already absolute (http/https or data URL), return as is if (/^(https?:)?\/\//i.test(val) || /^data:/i.test(val)) return val; // Otherwise, try to use as-is; backend might serve it relatively return val; } export default async function ProjectsPage() { const projects = await getProjects(); return(

Mes projets

); }