~netlandish/links

34fb3f69103801362e4937f8d32106a0c63b59f4 — Yader Velasquez 9 months ago dad066b
Fix autocomplete. Avoid displaying empty suggestion block
1 files changed, 7 insertions(+), 5 deletions(-)

M static/js/autocomplete.js
M static/js/autocomplete.js => static/js/autocomplete.js +7 -5
@@ 15,12 15,14 @@ tagSelector.addEventListener("keyup", function(event) {
                return response.json();
            })
            .then(function (data) {
                var t = "";
                for (var i=0; i < data.length; i++) {
                    t += '<p class="tag-suggested">' + data[i].Name + '</p>';
                if (data.length > 0) {
                    var t = "";
                    for (var i=0; i < data.length; i++) {
                        t += '<p class="tag-suggested">' + data[i].Name + '</p>';
                    }
                    autocompleteTags.innerHTML = t;
                    autocompleteTags.classList.remove("d-none");
                }
                autocompleteTags.innerHTML = t;
                autocompleteTags.classList.remove("d-none");
            })
            .catch(function (error) {
                console.log("Fetch error:", error);