Add is-loading to search input

This commit is contained in:
Peter Stuifzand 2020-07-12 18:01:19 +02:00
parent 5d924744de
commit e5e388d61e

View File

@ -6,6 +6,7 @@ function search(element) {
resolve({ resolve({
element: element, element: element,
search(query) { search(query) {
element.classList.add('is-loading')
return fetch('/search/?' + qs.encode({q:query})) return fetch('/search/?' + qs.encode({q:query}))
.then(res => res.json()) .then(res => res.json())
.then(data => { .then(data => {
@ -16,6 +17,7 @@ function search(element) {
title: value.id.replace(/_/g, ' '), title: value.id.replace(/_/g, ' '),
}) })
}) })
element.classList.remove('is-loading')
return actualResult return actualResult
}) })
} }