Преглед на файлове

fix: visiting station from homepage ManageStation would throw an error

Kristian Vos преди 3 години
родител
ревизия
6a357fbe80
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6 0
      frontend/src/main.js

+ 6 - 0
frontend/src/main.js

@@ -78,6 +78,7 @@ const router = createRouter({
 	history: createWebHistory(),
 	routes: [
 		{
+			name: "home",
 			path: "/",
 			component: () => import("@/pages/Home.vue")
 		},
@@ -168,6 +169,11 @@ router.beforeEach((to, from, next) => {
 		window.stationInterval = 0;
 	}
 
+	if (from.name === "home" && to.name === "station") {
+		if (store.state.modalVisibility.modals.manageStation)
+			store.dispatch("modalVisibility/closeModal", "manageStation");
+	}
+
 	if (ws.socket && to.fullPath !== from.fullPath) {
 		ws.clearCallbacks();
 		ws.destroyListeners();