From 5c3459b7c7e728bc77ff6715e7ab0d11185ca8f6 Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Wed, 5 Jun 2024 16:08:45 -0400 Subject: [PATCH] wip --- src/registrar/assets/js/get-gov.js | 21 +++++++++++++++------ src/registrar/templates/home.html | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/registrar/assets/js/get-gov.js b/src/registrar/assets/js/get-gov.js index 1371af45b..b5d006f03 100644 --- a/src/registrar/assets/js/get-gov.js +++ b/src/registrar/assets/js/get-gov.js @@ -1189,6 +1189,20 @@ document.addEventListener('DOMContentLoaded', function() { 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 loadDomains(1); } @@ -1248,19 +1262,14 @@ document.addEventListener('DOMContentLoaded', function() { throw new Error(`HTTP error! status: ${response.status}`); } 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)); } // Helper function to get the CSRF token from the cookie function getCsrfToken() { return document.querySelector('input[name="csrfmiddlewaretoken"]').value; -} + } /** diff --git a/src/registrar/templates/home.html b/src/registrar/templates/home.html index f0bed41c4..94b95e7fc 100644 --- a/src/registrar/templates/home.html +++ b/src/registrar/templates/home.html @@ -91,7 +91,7 @@