-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindexV1.html
53 lines (49 loc) · 1.67 KB
/
indexV1.html
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HCB Organization Info</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
#result {
margin-top: 20px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
</style>
</head>
<body>
<h1>HCB Organization Info</h1>
<input type="text" id="orgId" placeholder="Enter organization ID or slug">
<button onclick="fetchOrgInfo()">Get Info</button>
<div id="result"></div>
<script>
async function fetchOrgInfo() {
const orgId = document.getElementById('orgId').value;
const resultDiv = document.getElementById('result');
try {
const response = await fetch(`https://hcb.hackclub.com/api/v3/organizations/${orgId}`);
if (!response.ok) {
throw new Error('Organization not found or not in Transparency Mode');
}
const data = await response.json();
const orgName = data.name;
const totalRaised = (data.balances.total_raised / 100).toFixed(2); // Convert cents to dollars
resultDiv.innerHTML = `
<h2>${orgName}</h2>
<p>Total Amount Raised: $${totalRaised}</p>
`;
} catch (error) {
resultDiv.innerHTML = `<p>Error: ${error.message}</p>`;
}
}
</script>
</body>
</html>