mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2025-07-30 05:32:00 +00:00
Load initial high five count
This commit is contained in:
parent
487cd8cbd7
commit
0df997d594
1 changed files with 5 additions and 2 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue