// โ ๏ธ COMPILARE PRIMA DI INIZIARE const BASE_URL = 'http://localhost:3000/api'; /** * ESERCIZIO 3: Recupera un utente E tutti i suoi post * * Devi completare questa funzione: * 1. Leggi l'ID dell'utente * 2. Fai DUE fetch: * - GET /users/{id} * - GET /posts * 3. Filtra i post per trovare solo quelli di questo utente (usando userId) * 4. Mostra i risultati * 5. Gestisci gli errori */ async function fetchUserAndPosts() { const userId = document.getElementById('userId').value; const loading = document.getElementById('loading'); const userProfile = document.getElementById('userProfile'); const postsContainer = document.getElementById('postsContainer'); if (!userId || userId < 1 || userId > 40) { userProfile.innerHTML = '
${post.contenuto}