// js/api.js async function apiGet(url) { return fetch(url, { headers: { "Authorization": "Bearer " + localStorage.getItem("token") } }).then(r => r.json()); } async function getAllPhotos() { return apiGet(`${BASE_URL}/photos`); } async function getPhotoById(id) { const payload = parseJwt(localStorage.getItem("token")); const user = payload.name || "Common"; const url = `${BASE_URL}/photos/byIds?id=${encodeURIComponent(id)}&user=${encodeURIComponent(user)}`; console.log("🔍 [getPhotoById] URL:", url); return apiGet(url); } async function getChanges(since, user) { return apiGet(`${BASE_URL}/photos/changes?since=${encodeURIComponent(since)}&user=${encodeURIComponent(user)}`); }