From 555384aaecfcae90d47127476fc146baba1b3aaf Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 2 Dec 2020 21:28:52 +0100 Subject: [PATCH] =?UTF-8?q?Dodano=20support=20przy=20klikni=C4=99ciu=20sce?= =?UTF-8?q?nerii=20offline.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/StationsView/StationTable.vue | 14 +++++++++----- src/scripts/interfaces/Station.ts | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/StationsView/StationTable.vue b/src/components/StationsView/StationTable.vue index 98aa924..fdbe5b1 100644 --- a/src/components/StationsView/StationTable.vue +++ b/src/components/StationsView/StationTable.vue @@ -202,12 +202,16 @@ export default class StationTable extends styleMixin { @Prop() readonly changeSorter!: () => void; setScenery(sceneryHash: string) { - if ( - this.stations.findIndex( - (station) => station.stationHash === sceneryHash && station.online - ) == -1 - ) + const station = this.stations.find( + (station) => station.stationHash === sceneryHash + ); + + if (!station) return; + + if (!station.online) { + location.href = station.stationURL; return; + } this.$router.push({ name: "SceneryView", query: { hash: sceneryHash } }); } diff --git a/src/scripts/interfaces/Station.ts b/src/scripts/interfaces/Station.ts index 98ff8be..84fc079 100644 --- a/src/scripts/interfaces/Station.ts +++ b/src/scripts/interfaces/Station.ts @@ -4,6 +4,7 @@ import ScheduledTrain from './ScheduledTrain'; export default interface Station { stationName: string; stationHash: string; + stationURL: string; maxUsers: number; currentUsers: number;