From 23aa2da9cac03e07188c549ba6d80431197b28d6 Mon Sep 17 00:00:00 2001 From: "Ali.t.nazari" Date: Sat, 25 Mar 2023 14:33:31 +0430 Subject: [PATCH] resolve bad user inputs --- src/js/app.js | 6 +++--- src/pug/template.pug | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/js/app.js b/src/js/app.js index 69ca58f..87ca4f8 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -53,12 +53,12 @@ function addTemplate() { } function addApiResponseData(data) { - $.querySelector('#name').innerHTML = data.name; + $.querySelector('#name').innerHTML = data.name || 'not found'; $.querySelector('#temperature').innerHTML = `${convertFahrenheitToCelsius( data.main.temp - )}℃`; + )}℃` ; $.querySelector('#date').innerHTML = moment().format('dddd MMMM Do YYYY'); - $.querySelector('#state').innerHTML = data.weather.at(0).main; + $.querySelector('#state').innerHTML = data.weather.at(0).main ; $.querySelector('#low_temp').innerHTML = `${convertFahrenheitToCelsius( data.main.temp_min )}℃`; diff --git a/src/pug/template.pug b/src/pug/template.pug index e894af7..f155248 100644 --- a/src/pug/template.pug +++ b/src/pug/template.pug @@ -1,9 +1,9 @@ template#main_template - p#name Northampton, GB - p#date Thursday 10 January 2020 - h1#temperature 15℃ - h3#state Sunny + p#name not found + p#date not found + h1#temperature .. + h3#state ¯\(°_o)/¯ p.mt-3 - span#low_temp 13℃ + span#low_temp .. | / - span#high_temp 16℃ \ No newline at end of file + span#high_temp .. \ No newline at end of file