Skip to content

Commit

Permalink
optimalization
Browse files Browse the repository at this point in the history
  • Loading branch information
pakut2 committed Feb 24, 2021
1 parent 5c21955 commit f54df45
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ const app = () => {
};

//add from local to ui
const getTerminus = () => {
const getTerminus = async () => {
let terminus;
if (localStorage.getItem("terminus") === null) {
terminus = [];
Expand All @@ -440,14 +440,14 @@ const app = () => {
directions = JSON.parse(localStorage.getItem("directions"));
}

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 API_URL =
"https://ckan.multimediagdansk.pl/dataset/c24aa637-3619-4dc2-a171-a23eec8f2172/resource/d3e96eb6-25ad-4d6c-8651-b1eb39155945/download/stopsingdansk.json";

const { stops, stopId, stopName, stopCode, zoneId } = data;
let response = await fetch(API_URL);
let data = await response.json();
const { stops, stopId, stopName, stopCode, zoneId } = data;

const getData = async (arg) => {
let input = arg;
let ID;
let dataArr = [];
Expand All @@ -464,9 +464,9 @@ const app = () => {
}
}

API_URL = `https://ckan2.multimediagdansk.pl/delays?stopId=${ID}`;
const ID_API_URL = `https://ckan2.multimediagdansk.pl/delays?stopId=${ID}`;

response = await fetch(API_URL);
response = await fetch(ID_API_URL);
data = await response.json();

const { delay, estimatedTime, routeId, headsign } = data;
Expand Down
18 changes: 9 additions & 9 deletions js/directSearchApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,22 +273,22 @@ const app = () => {
};

//add from local to ui
const getDirect = () => {
const getDirect = async () => {
let direct;
if (localStorage.getItem("direct") === null) {
direct = [];
} else {
direct = JSON.parse(localStorage.getItem("direct"));
}

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 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;
const { stops, stopId, stopName, stopCode, zoneId } = data;

const getData = async (arg) => {
let input = arg;
let words = input.split(" ");
let code = words[words.length - 1];
Expand All @@ -312,9 +312,9 @@ const app = () => {
}
}

API_URL = `https://ckan2.multimediagdansk.pl/delays?stopId=${ID}`;
ID_API_URL = `https://ckan2.multimediagdansk.pl/delays?stopId=${ID}`;

response = await fetch(API_URL);
response = await fetch(ID_API_URL);
data = await response.json();

const { delay, estimatedTime, routeId, headsign } = data;
Expand Down

0 comments on commit f54df45

Please sign in to comment.