async function addIndexView() { try { // Huidige data ophalen const res = await fetch(URL, { headers: { "X-Master-Key": API_KEY } }); const json = await res.json(); const data = json.record; // "index" toevoegen als hij nog niet bestaat data.index = (data.index || 0) + 1; // Nieuwe data terugsturen naar JSONBin await fetch(URL, { method: "PUT", headers: { "Content-Type": "application/json", "X-Master-Key": API_KEY }, body: JSON.stringify(data) }); console.log("Index view added!"); } catch (err) { console.error("Failed to add index view:", err); } }