mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
Merge pull request #1261 from hackclub/arcade-stickers-in-stock
Create stickers-in-stock.html
This commit is contained in:
commit
4e7dd008da
1 changed files with 57 additions and 0 deletions
57
public/stickers-in-stock.html
Normal file
57
public/stickers-in-stock.html
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Hack Club | Available Stickers</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
|
||||
<link rel="favicon" href="/favicon.png">
|
||||
<link rel="shortcut icon" href="/favicon.png">
|
||||
<link rel="icon" href="/favicon.png">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Available Hack Club Stickers</h1>
|
||||
<h2 id="header">Stickers In-Stock</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Image</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="body">
|
||||
<tr>
|
||||
<td>Loading...</td>
|
||||
<td>Please wait</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
const header = document.querySelector('#header');
|
||||
const tbody = document.querySelector('#body');
|
||||
|
||||
fetch("https://arcade-stickers.hackclub.dev/api/skus/all")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
blocked = false;
|
||||
tbody.innerHTML = `
|
||||
${data.items.map(i => `
|
||||
<tr>
|
||||
<td>${i.name}</td>
|
||||
<td><img src="${i.picture}" alt="${i.name}" width="100"></td>
|
||||
</tr>
|
||||
`).join("")}
|
||||
`;
|
||||
header.textContent = `Stickers In-Stock (${data.items.length})`;
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
blocked = false;
|
||||
tbody.innerHTML = `<tr>
|
||||
<td>Error</td>
|
||||
<td>Error</td>
|
||||
</tr>`;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue