Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pakut2 committed Feb 24, 2021
1 parent ab50f9b commit 5c21955
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
11 changes: 8 additions & 3 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,15 @@ const app = () => {
directions = JSON.parse(localStorage.getItem("directions"));
}

terminus.forEach(async (stop) => {
const getData = async (arg) => {
let API_URL =
"https://ckan.multimediagdansk.pl/dataset/c24aa637-3619-4dc2-a171-a23eec8f2172/resource/d3e96eb6-25ad-4d6c-8651-b1eb39155945/download/stopsingdansk.json";
let response = await fetch(API_URL);
let data = await response.json();

const { stops, stopId, stopName, stopCode, zoneId } = data;

let input = stop;
let input = arg;
let ID;
let dataArr = [];

Expand Down Expand Up @@ -586,7 +586,12 @@ const app = () => {

stopList.appendChild(cardDiv);
dragAndDrop();
});
};

terminus.reduce(async (prev, arg) => {
await prev;
return getData(arg);
}, Promise.resolve());
};

//remove from local
Expand Down
15 changes: 10 additions & 5 deletions js/directSearchApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ const app = () => {
direct = JSON.parse(localStorage.getItem("direct"));
}

direct.forEach(async (stop) => {
const getData = async (arg) => {
let API_URL =
"https://ckan.multimediagdansk.pl/dataset/c24aa637-3619-4dc2-a171-a23eec8f2172/resource/d3e96eb6-25ad-4d6c-8651-b1eb39155945/download/stopsingdansk.json";
let response = await fetch(API_URL);
let data = await response.json();

const { stops, stopId, stopName, stopCode, zoneId } = data;

let input = stop;
let input = arg;
let words = input.split(" ");
let code = words[words.length - 1];
input = "";
Expand Down Expand Up @@ -424,9 +424,16 @@ const app = () => {

stopList.appendChild(cardDiv);
dragAndDrop();
});
};

direct.reduce(async (prev, arg) => {
await prev;
return getData(arg);
}, Promise.resolve());
};

document.addEventListener("DOMContentLoaded", getDirect);

//remove from local
const removeLocalDirect = (stop) => {
let direct;
Expand All @@ -441,8 +448,6 @@ const app = () => {
localStorage.setItem("direct", JSON.stringify(direct));
};

document.addEventListener("DOMContentLoaded", getDirect);

//refreshes data
const refresh = () => {
const cards = document.querySelectorAll(".card");
Expand Down

0 comments on commit 5c21955

Please sign in to comment.