diff --git a/src/components/JournalView/DispatcherStats.vue b/src/components/JournalView/DispatcherStats.vue index a2fb70f..4e97b9d 100644 --- a/src/components/JournalView/DispatcherStats.vue +++ b/src/components/JournalView/DispatcherStats.vue @@ -53,7 +53,7 @@ import { TimetableHistory } from '@/scripts/interfaces/api/TimetablesAPIData'; import { URLs } from '@/scripts/utils/apiURLs'; import { useStore } from '@/store/store'; import axios from 'axios'; -import { defineComponent } from 'vue'; +import { computed, defineComponent } from 'vue'; import Loading from '../Global/Loading.vue'; export default defineComponent({ @@ -61,10 +61,19 @@ export default defineComponent({ setup() { const store = useStore(); + + const statsData2 = computed(async () => { + return await ( + await axios.get(`${URLs.stacjownikAPI}/api/getDispatcherInfo?name=${store.dispatcherStatsName}`) + ).data; + }); + return { store, + statsData2, }; }, + data() { return { cardVisible: false, @@ -72,6 +81,7 @@ export default defineComponent({ timetables: [] as TimetableHistory[], }; }, + methods: { toggleCard() { if (!this.store.dispatcherStatsName) return; diff --git a/src/scripts/utils/apiURLs.ts b/src/scripts/utils/apiURLs.ts index fc88060..8bb2a0a 100644 --- a/src/scripts/utils/apiURLs.ts +++ b/src/scripts/utils/apiURLs.ts @@ -1,6 +1,6 @@ export const URLs = { - stacjownikAPI: 'https://stacjownik.eu-4.evennode.com', - stacjownikAPIDev: 'http://stacjownik-dev.eu-4.evennode.com', + stacjownikAPI: process.env.VUE_APP_API_DEV != 1 ? 'https://stacjownik.eu-4.evennode.com' : 'http://localhost:3000', + stacjownikAPIDev: 'localhost:3000', // trains: "https://api.td2.info.pl:9640/?method=getTrainsOnline", // getTimetableURL: (trainNo: string | number, region = "eu") => `https://api.td2.info.pl:9640/?method=readFromSWDR&value=getTimetable%3B${trainNo}%3B${region}` }; diff --git a/src/store/store.ts b/src/store/store.ts index 79abe23..d9f6e65 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -330,16 +330,11 @@ export const useStore = defineStore('store', { }, connectToWebsocket() { - const socket = io( - process.env.NODE_ENV !== 'production' && process.env.VUE_APP_WS_DEV == 1 - ? URLs.stacjownikAPIDev - : URLs.stacjownikAPI, - { - transports: ['websocket', 'polling'], - rememberUpgrade: true, - reconnection: true, - } - ); + const socket = io(URLs.stacjownikAPI, { + transports: ['websocket', 'polling'], + rememberUpgrade: true, + reconnection: true, + }); socket.on('UPDATE', (data: APIData) => { this.apiData = data;