Load initial high five count

This commit is contained in:
Brandon Rozek 2025-06-11 22:24:00 -04:00
parent 487cd8cbd7
commit 0df997d594
No known key found for this signature in database
GPG key ID: DFB0E78F805F4567

View file

@ -96,6 +96,9 @@
// Enable button now that JavaScript is available
elements.button.classList.remove('no-js');
elements.button.addEventListener('click', handleHighFiveClick);
// Load initial count
loadHighFiveCount();
}
/**
@ -149,7 +152,7 @@
const data = await makeApiRequest('POST');
const newCount = data.count || currentCount;
currentCount = newCount;
// Check if user already gave a high five (HTTP 409 response)
if (data.alreadyHighFived) {
updateButtonContent('check');
@ -160,7 +163,7 @@
showMessage('🎉 Thanks!', 'success');
setButtonState('disabled');
}
} catch (error) {
console.error('Failed to send high five:', error);