This commit is contained in:
David Kennedy 2024-06-05 16:08:45 -04:00
parent 8d8c31f37a
commit 5c3459b7c7
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
2 changed files with 16 additions and 7 deletions

View file

@ -1189,6 +1189,20 @@ document.addEventListener('DOMContentLoaded', function() {
tableAnnouncementRegion.innerHTML = ''; tableAnnouncementRegion.innerHTML = '';
} }
function resetSearch() {
domainsSearchInput.value = '';
loadDomains(1, 'id', 'asc', hasLoaded, '');
resetheaders();
}
resetButton = document.querySelector('.domains__reset-button');
if (resetButton) {
resetButton.addEventListener('click', function() {
resetSearch();
});
}
// Load the first page initially // Load the first page initially
loadDomains(1); loadDomains(1);
} }
@ -1248,19 +1262,14 @@ document.addEventListener('DOMContentLoaded', function() {
throw new Error(`HTTP error! status: ${response.status}`); throw new Error(`HTTP error! status: ${response.status}`);
} }
loadDomainRequests(pageToDisplay, currentSortBy, currentOrder, hasLoaded, currentSearchTerm); loadDomainRequests(pageToDisplay, currentSortBy, currentOrder, hasLoaded, currentSearchTerm);
//return response.json();
}) })
// .then(data => {
// console.log('response', data);
// // Perform any additional actions, e.g., updating the UI
// })
.catch(error => console.error('Error fetching domain requests:', error)); .catch(error => console.error('Error fetching domain requests:', error));
} }
// Helper function to get the CSRF token from the cookie // Helper function to get the CSRF token from the cookie
function getCsrfToken() { function getCsrfToken() {
return document.querySelector('input[name="csrfmiddlewaretoken"]').value; return document.querySelector('input[name="csrfmiddlewaretoken"]').value;
} }
/** /**

View file

@ -91,7 +91,7 @@
</div> </div>
<div class="domains__no-search-results display-none"> <div class="domains__no-search-results display-none">
<p>Nothing, nada, zilch.</p> <p>Nothing, nada, zilch.</p>
<p>Reset your search or try a different search term.</p> <p><button class='usa-button usa-button--unstyled domains__reset-button' type='button'>Reset your search</button> or try a different search term.</p>
</div> </div>
</section> </section>
<nav aria-label="Pagination" class="usa-pagination flex-justify" id="domains-pagination"> <nav aria-label="Pagination" class="usa-pagination flex-justify" id="domains-pagination">