-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathairdrop.js
More file actions
29 lines (25 loc) · 1.01 KB
/
Copy pathairdrop.js
File metadata and controls
29 lines (25 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const urlParams = new URLSearchParams(window.location.search);
const id = urlParams.get("id");
fetch("https://script.google.com/macros/s/AKfycbxB1eK89gWBtP2OaGjkabUiDih8bR5xN5ukgYv2OenApZ9-9v6SUqqIieiGldzI0Qlskw/exec")
.then((res) => res.json())
.then((data) => {
console.log("Fetched ID:", id);
console.log("Data:", data);
const drop = data.find((d) => d.id === id);
const section = document.getElementById("airdropDetail");
if (!drop) {
section.innerHTML = `<p>Airdrop not found 😢</p>`;
return;
}
section.innerHTML = `
<h1>${drop.name}</h1>
<img src="${drop.image}" alt="${drop.name}" />
<p>${drop.description}</p>
<a href="${drop.refLink}" target="_blank" class="hero-btn">Join Airdrop</a>
<a href="index.html" class="back-link">← Back to Airdrops</a>
`;
})
.catch((err) => {
console.error("Fetch error:", err);
document.getElementById("airdropDetail").innerHTML = `<p>Error loading airdrop 😓</p>`;
});