mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Cleanup kodu; zmiania URL środowiska dev
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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}`
|
||||
};
|
||||
|
||||
+5
-10
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user