katja's git: oeffisearch

fast and simple tripplanner

commit c79295dd3f626fc155371b1ff750070b89cea197
parent c32227d9b2eef78bacd0ce5fe8bbd3d4c3ce34a0
Author: Katja (ctucx) <git@ctu.cx>
Date: Sat, 19 Apr 2025 21:19:56 +0200

searchView: fix error handling
1 file changed, 5 insertions(+), 8 deletions(-)
M
src/searchView.js
|
13
+++++--------
diff --git a/src/searchView.js b/src/searchView.js
@@ -391,19 +391,16 @@ class SearchView extends BaseView {
 
 		if (isDevServer) console.info('submitHandler():',params);
 
-		this.showLoaderOverlay();
-
-		let responseData;
 		try {
-			responseData = await newJourneys(params);
+			this.showLoaderOverlay();
+			const responseData = await newJourneys(params);
+
+			window.location = `#/${responseData.slug}/${this.settingsState.journeysViewMode}`;
+			this.hideOverlay();
 		} catch(e) {
 			this.showAlertOverlay(e.toString());
 			console.error(e);
 		}
-
-		this.hideOverlay();
-
-		window.location = `#/${responseData.slug}/${this.settingsState.journeysViewMode}`;
 	}
 
 	mouseOverHandler (name) { this.location[name].suggestionsFocused = true; }