Compare commits
No commits in common. "2b6449f61b44fd929b9b45773fe3ce851ca65f7b" and "d431f34e7296ce7d42a66f96f4da950ae1de0d70" have entirely different histories.
2b6449f61b
...
d431f34e72
4 changed files with 4 additions and 60 deletions
|
|
@ -14,6 +14,7 @@ function persistRsvp(hasRsvped = true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function rsvpButtonClicked() {
|
function rsvpButtonClicked() {
|
||||||
|
console.log("here");
|
||||||
persistRsvp(true);
|
persistRsvp(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/style.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1 class="title fontXL textCenter backgroundLightGreen colorWhite">Collin and Lucy's Wedding</h1>
|
|
||||||
<div class="contents fontM">
|
|
||||||
<label for="username">Username</label>
|
|
||||||
<input type="text" name="username" id="username">
|
|
||||||
|
|
||||||
<label for="password">Password</label>
|
|
||||||
<input type="password" name="password" id="password">
|
|
||||||
|
|
||||||
<button onclick="login">Login</button>
|
|
||||||
</div>
|
|
||||||
<script src="/login.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
function login() {
|
|
||||||
const usernameInput = document.getElementById('username');
|
|
||||||
const passwordInput = document.getElementById('password');
|
|
||||||
|
|
||||||
const token = btoa(`${usernameInput.textContent}:${passwordInput.textContent}`);
|
|
||||||
document.cookie = `token=${String(token)}; path=/`;
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +1,11 @@
|
||||||
function createRsvpEntry(rsvp) {
|
function createRsvpEntry(rsvp) {
|
||||||
const table = document.getElementById('rsvpsTable');
|
|
||||||
const tbody = table.children.item(0)
|
|
||||||
|
|
||||||
const { attending, partyMembers } = rsvp;
|
|
||||||
|
|
||||||
for (const member of partyMembers) {
|
|
||||||
const newRow = document.createElement('tr');
|
|
||||||
|
|
||||||
const attendingColumn = document.createElement('td');
|
|
||||||
attendingColumn.innerText = attending ? '✅' : '❌';
|
|
||||||
|
|
||||||
const nameColumn = document.createElement('td');
|
|
||||||
nameColumn.innerText = member.name;
|
|
||||||
|
|
||||||
const childColumn = document.createElement('td');
|
|
||||||
childColumn.innerText = member.child ? '👶' : '🧓';
|
|
||||||
|
|
||||||
const dietaryPreferencesColumn = document.createElement('td');
|
|
||||||
dietaryPreferencesColumn.innerText = member.dietaryPreferences.length > 0 ? member.dietaryPreferences : 'n/a';
|
|
||||||
|
|
||||||
newRow.appendChild(attendingColumn);
|
|
||||||
newRow.appendChild(nameColumn);
|
|
||||||
newRow.appendChild(childColumn);
|
|
||||||
newRow.appendChild(dietaryPreferencesColumn);
|
|
||||||
|
|
||||||
tbody.appendChild(newRow);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getRsvps() {
|
async function getRsvps() {
|
||||||
const token = Object.fromEntries(
|
// token is test:test for now
|
||||||
document.cookie.split(";").map((x) => x.trim().split("="))
|
const resp = await fetch('/api/rsvps', { headers: { 'Authorization': 'Basic dGVzdDp0ZXN0'} })
|
||||||
)['token']
|
JSON.parse(resp.body)
|
||||||
const resp = await fetch('/api/rsvps', { headers: { 'Authorization': `Basic ${token}`} });
|
|
||||||
const rsvps = await resp.json()
|
|
||||||
for (const rsvp of rsvps) {
|
|
||||||
createRsvpEntry(rsvp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = async function () {
|
window.onload = async function () {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue