Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/onweru/newsroom.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweru <onewesh@gmail.com>2020-09-18 06:18:17 +0300
committerweru <onewesh@gmail.com>2020-09-18 06:18:23 +0300
commite48627654cadaa2d471d0e54bcb36720f8567536 (patch)
treebe32da4b5354025c116adc2d77df2557ac34717a
parent66ab8b94af2dd48a4365ecf51d8ee6b0795eeb8b (diff)
set icon to empty string if fetch fails #23
-rw-r--r--assets/js/index.js7
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;