ctucx.git: oeffisearch

[nimlang] fast and simple tripplanner

commit 8fc01cf9860339565457f34cd970393a31542db4
parent 1a3556679b0493b762e7c9d8d728c7644d02fa35
Author: Milan Pässler <milan@petabyte.dev>
Date: Fri, 18 Sep 2020 21:14:47 +0200

searchView: various code improvements
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/client/js/searchView.js b/client/js/searchView.js
@@ -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");