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