Formatting + Added Home Page

This commit is contained in:
IM23a-spirgif
2025-04-17 13:56:44 +02:00
parent 31eb975007
commit 38ae2eb785
4 changed files with 31 additions and 10 deletions
+19
View File
@@ -0,0 +1,19 @@
document.addEventListener("DOMContentLoaded", async () => {
const logoutButton = document.getElementById("logout");
const balance = document.getElementById("balance");
try {
const balanceRes = await fetch('/balance', {
method: "GET",
headers: {
"Content-Type": "application/json",
}
});
if (balanceRes.ok) {
const balanceData = await balanceRes.json();
console.log(balanceData);
balance.innerHTML = balanceData.balance;
}
} catch (error) {
console.log(error);
}
});
+6 -6
View File
@@ -4,13 +4,13 @@
<meta charset="UTF-8">
<title>Home</title>
<link rel="stylesheet" href="styles_home.css">
<script src="frontend_home.js" defer></script> <!-- make sure this is included -->
</head>
<body>
<button class="logout">
Logout
</button>
<button class="balance">
Check Balance
</button>
<button class="logout" id="logout">Logout</button>
<div class="balance">
Balance: $<span id="balance">0</span>
</div>
</body>
</html>
+3 -1
View File
@@ -46,6 +46,8 @@ button.logout {
font-size: 14px;
}
button.balance {
.balance {
margin-top: 20px;
color: #0f0;
text-shadow: 0 0 5px #0f0, 0 0 10px #0f0;
}