searchView: various code improvements
This commit is contained in:
parent
1a3556679b
commit
8fc01cf986
|
@ -12,7 +12,7 @@ import { showSettings } from './settingsView.js';
|
|||
|
||||
let currDate = new Date();
|
||||
let fromValue = '';
|
||||
let viaValue = '';
|
||||
let viaValue = '';
|
||||
let toValue = '';
|
||||
let isArrValue = false;
|
||||
let dateValue = currDate.getFullYear()+'-'+padZeros(currDate.getMonth()+1)+'-'+padZeros(currDate.getDate());;
|
||||
|
@ -227,7 +227,7 @@ export const search = async (requestId) => {
|
|||
if (Object.entries(suggestionsCache.from).length !== 0) {
|
||||
from = suggestionsCache.from;
|
||||
} else {
|
||||
let suggestions = await get("/suggestions", {"query": ElementById('from').value, "results": 1}, true);
|
||||
let suggestions = await get("/suggestions", {"query": fromValue, "results": 1}, true);
|
||||
|
||||
if (!suggestions[0]) {
|
||||
showAlertModal("Abfahrtsbahnof ungültig");
|
||||
|
@ -242,10 +242,10 @@ export const search = async (requestId) => {
|
|||
} else if (Object.entries(suggestionsCache.via).length !== 0) {
|
||||
via = suggestionsCache.via;
|
||||
} else {
|
||||
let suggestions = await get("/suggestions", {"query": ElementById('via').value, "results": 1}, true);
|
||||
let suggestions = await get("/suggestions", {"query": viaValue, "results": 1}, true);
|
||||
|
||||
if (!suggestions[0]) {
|
||||
showAlertModal("Ankunftsbahnhof ungültig");
|
||||
showAlertModal("Via-Bahnhof ungültig");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ export const search = async (requestId) => {
|
|||
if (Object.entries(suggestionsCache.to).length !== 0) {
|
||||
to = suggestionsCache.to;
|
||||
} else {
|
||||
let suggestions = await get("/suggestions", {"query": ElementById('to').value, "results": 1}, true);
|
||||
let suggestions = await get("/suggestions", {"query": toValue, "results": 1}, true);
|
||||
|
||||
if (!suggestions[0]) {
|
||||
showAlertModal("Ankunftsbahnhof ungültig");
|
||||
|
|
Loading…
Reference in a new issue