26 lines
541 B
JavaScript
26 lines
541 B
JavaScript
// ===============================
|
|
// FETCH DELLE FOTO
|
|
// ===============================
|
|
async function loadPhotos() {
|
|
console.log("Inizio fetch:", API_URL);
|
|
|
|
let res;
|
|
try {
|
|
res = await fetch(API_URL);
|
|
} catch (e) {
|
|
console.error("Errore fetch:", e);
|
|
return;
|
|
}
|
|
|
|
const text = await res.text();
|
|
|
|
try {
|
|
photosData = JSON.parse(text);
|
|
console.log("JSON parse OK, numero foto:", photosData.length);
|
|
} catch (e) {
|
|
console.error("Errore nel parse JSON:", e);
|
|
return;
|
|
}
|
|
|
|
renderGallery(photosData);
|
|
}
|