소스 검색

refactor: ManageStation is closed upon station deletion, and user is shown message when redirected from deleted station

Kristian Vos 3 년 전
부모
커밋
b79b821fef
2개의 변경된 파일10개의 추가작업 그리고 4개의 파일을 삭제
  1. 9 3
      frontend/src/components/modals/ManageStation/index.vue
  2. 1 1
      frontend/src/pages/Station/index.vue

+ 9 - 3
frontend/src/components/modals/ManageStation/index.vue

@@ -410,6 +410,15 @@ export default {
 					},
 					{ modal: "manageStation" }
 				);
+
+				this.socket.on(
+					"event:station.deleted",
+					() => {
+						new Toast(`The station you were editing was deleted.`);
+						this.closeModal("manageStation");
+					},
+					{ modal: "manageStation" }
+				);
 			} else {
 				new Toast(`Station with that ID not found`);
 				this.closeModal("manageStation");
@@ -561,9 +570,6 @@ export default {
 		removeStation() {
 			this.socket.dispatch("stations.remove", this.station._id, res => {
 				new Toast(res.message);
-				if (res.status === "success") {
-					this.closeModal("manageStation");
-				}
 			});
 		},
 		resumeStation() {

+ 1 - 1
frontend/src/pages/Station/index.vue

@@ -1088,7 +1088,7 @@ export default {
 		});
 
 		this.socket.on("event:station.deleted", () => {
-			window.location.href = "/";
+			window.location.href = "/?msg=The station you were in was deleted.";
 			return true;
 		});