From d204000fedd8a4d980451368846a7cd2090e4685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Thu, 15 Sep 2022 07:58:58 -0700 Subject: [PATCH] Only add to state if fetch request has contents. --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index f37d5dab..3e4c9e86 100644 --- a/index.js +++ b/index.js @@ -49,9 +49,11 @@ for (let index = 0; index < array.length; index++) { const file = basePath + array[index]; const response = await fetch(file); - const log = await response.json(); - log._uri = `/home/m/repos/dashboard/samples/commit_2/${array[index]}`; - store.logs.push(log); + if (response.ok) { + const log = await response.json(); + log._uri = `/home/steven/osrf/space-ros/dashboard/samples/commit_2/${array[index]}`; + store.logs.push(log); + } } } await loadLogs(store, baselineFolder + "1/");