diff options
author | weru <onewesh@gmail.com> | 2020-09-18 06:18:17 +0300 |
---|---|---|
committer | weru <onewesh@gmail.com> | 2020-09-18 06:18:23 +0300 |
commit | e48627654cadaa2d471d0e54bcb36720f8567536 (patch) | |
tree | be32da4b5354025c116adc2d77df2557ac34717a | |
parent | 66ab8b94af2dd48a4365ecf51d8ee6b0795eeb8b (diff) |
set icon to empty string if fetch fails #23
-rw-r--r-- | assets/js/index.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/assets/js/index.js b/assets/js/index.js index 54b0185..169f7ea 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -1,4 +1,4 @@ -(function(){ +(function(){ const doc = document.documentElement; const parentURL = '{{ absURL "/" }}'; @@ -113,8 +113,6 @@ doc.addEventListener('click', function(event) { let target = event.target; - // alert(target); - console.log(target); const isNavDrop = isTarget(target, 'nav-drop', true); const isNavClose = isTarget(target,'nav-close', true); const isNavBar = isTarget(target, 'nav_bar-wrap'); @@ -199,7 +197,8 @@ const link = `${parentURL}${path}${file}.svg`; fetch(link) .then((response) => { - return response.text(); + const data = response.status == 200 ? response.text() : ""; + return data; }) .then((data) => { parent.innerHTML = data; |