diff --git a/src/components/StationsView/StationFilterCard.vue b/src/components/StationsView/StationFilterCard.vue index 3092272..74180e8 100644 --- a/src/components/StationsView/StationFilterCard.vue +++ b/src/components/StationsView/StationFilterCard.vue @@ -167,7 +167,6 @@ export default defineComponent({ handleChangeRegion() { this.$store.commit(MUTATIONS.SET_REGION, this.currentRegion); - this.$store.dispatch(ACTIONS.fetchOnlineData); this.closeCard(); }, diff --git a/src/scripts/utils/storeUtils.ts b/src/scripts/utils/storeUtils.ts index 295bdc4..661480f 100644 --- a/src/scripts/utils/storeUtils.ts +++ b/src/scripts/utils/storeUtils.ts @@ -4,8 +4,8 @@ import TrainStop from "../interfaces/TrainStop"; export const getLocoURL = (locoType: string): string => (`https://rj.td2.info.pl/dist/img/thumbnails/${locoType.includes("EN") ? locoType + "rb" : locoType}.png`) export const getStatusID = (stationStatus: any): string => { - if (!stationStatus) return "not-signed"; - if (stationStatus == -1) return "unknown"; + if (!stationStatus) return "unknown"; + if (stationStatus == -1) return "unavailable"; const statusCode = stationStatus[2]; const statusTimestamp = stationStatus[3]; @@ -30,7 +30,7 @@ export const getStatusID = (stationStatus: any): string => { break; } - return "unavailable"; + return "not-signed"; }; export const getStatusTimestamp = (stationStatus: any): number => { diff --git a/src/store/index.ts b/src/store/index.ts index 73e6b08..1c9bbe0 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -169,7 +169,6 @@ export const store = createStore({ commit(MUTATIONS.SET_DISPATCHER_DATA_STATUS, !data.dispatchers ? DataStatus.Warning : DataStatus.Loaded) commit(MUTATIONS.SET_TRAINS_DATA_STATUS, !data.trains ? DataStatus.Warning : DataStatus.Loaded); - // Zaktualizuj listę pociągów const updatedTrainList: Train[] = data.trains @@ -394,6 +393,7 @@ export const store = createStore({ SET_REGION(state, region: { id: string; value: string }) { state.region = region; + state.webSocket?.emit('FETCH_DATA'); }, }