diff options
Diffstat (limited to 'app/assets/javascripts/pages/search/show/refresh_counts.js')
-rw-r--r-- | app/assets/javascripts/pages/search/show/refresh_counts.js | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/app/assets/javascripts/pages/search/show/refresh_counts.js b/app/assets/javascripts/pages/search/show/refresh_counts.js deleted file mode 100644 index f3f6312cb7c..00000000000 --- a/app/assets/javascripts/pages/search/show/refresh_counts.js +++ /dev/null @@ -1,24 +0,0 @@ -import axios from '~/lib/utils/axios_utils'; - -function showCount(el, count) { - el.textContent = count; - el.classList.remove('hidden'); -} - -function refreshCount(el) { - const { url } = el.dataset; - - return axios - .get(url) - .then(({ data }) => showCount(el, data.count)) - .catch((e) => { - // eslint-disable-next-line no-console - console.error(`Failed to fetch search count from '${url}'.`, e); - }); -} - -export default function refreshCounts() { - const elements = Array.from(document.querySelectorAll('.js-search-count')); - - return Promise.all(elements.map(refreshCount)); -} |