diff --git a/index.mjs b/index.mjs index 0a86d79..c5c4b07 100755 --- a/index.mjs +++ b/index.mjs @@ -2,7 +2,7 @@ import fetch from "node-fetch"; const APIURI = "https://fi.jamix.cloud/apps/menuservice/rest/haku/menu/92225/1?lang=fi"; -const myArgs = process.argv.slice(2); +const weekday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; function getAllFoods(data) { // get the list of days and sort them by date ascending (the api for some reason sorts by weekday) @@ -12,7 +12,7 @@ function getAllFoods(data) { const foods = []; days.map((day) => { - foods.push(String(day.date)); + foods.push(`${weekday[day.weekday]}, ${String(day.date)}`); day.mealoptions.map((mealoption, index) => { let str = "" str += mealoption.name + ": " @@ -30,4 +30,4 @@ function getAllFoods(data) { fetch(APIURI) .then(response => response.json()) .then(data => getAllFoods(data).map(food => console.log(food))) - .catch(err => console.error("Error when fetching resource (api endpoint might be down)")); + .catch(() => console.error("Error when fetching resource (api endpoint might be down)"));