fix: null-safe icon selectors after table restructure (#4)
This commit is contained in:
+6
-10
@@ -261,8 +261,8 @@ async function refreshRoundHistory(pdgaNumber) {
|
||||
}
|
||||
|
||||
async function refreshRatingHistory(pdgaNumber) {
|
||||
const icon = document.querySelector(`#history-${pdgaNumber} .chart-title .refresh-icon`);
|
||||
icon.classList.add('spinning');
|
||||
// No dedicated icon in the expanded row; spinner state not needed here
|
||||
const icon = null;
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/refresh-rating-history/${pdgaNumber}`, { method: 'POST' });
|
||||
@@ -277,8 +277,6 @@ async function refreshRatingHistory(pdgaNumber) {
|
||||
} catch (error) {
|
||||
console.error('Error refreshing rating history:', error);
|
||||
alert('Failed to refresh rating history');
|
||||
} finally {
|
||||
icon.classList.remove('spinning');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,10 +327,9 @@ async function searchAndAddPlayer(event) {
|
||||
return;
|
||||
}
|
||||
|
||||
const button = document.querySelector('.btn-add');
|
||||
const originalText = button.textContent;
|
||||
button.disabled = true;
|
||||
button.textContent = 'Searching...';
|
||||
const button = document.querySelector('.add-bar button[type="submit"]');
|
||||
const originalText = button ? button.textContent : '';
|
||||
if (button) { button.disabled = true; button.textContent = 'Searching...'; }
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/search-player/${pdgaNumber}`);
|
||||
@@ -355,8 +352,7 @@ async function searchAndAddPlayer(event) {
|
||||
console.error('Error searching for player:', error);
|
||||
showErrorModal('Failed to search for player. Please try again.');
|
||||
} finally {
|
||||
button.disabled = false;
|
||||
button.textContent = originalText;
|
||||
if (button) { button.disabled = false; button.textContent = originalText; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user