mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28: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 { URLs } from '@/scripts/utils/apiURLs';
|
||||||
import { useStore } from '@/store/store';
|
import { useStore } from '@/store/store';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { defineComponent } from 'vue';
|
import { computed, defineComponent } from 'vue';
|
||||||
import Loading from '../Global/Loading.vue';
|
import Loading from '../Global/Loading.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -61,10 +61,19 @@ export default defineComponent({
|
|||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
|
||||||
|
const statsData2 = computed(async () => {
|
||||||
|
return await (
|
||||||
|
await axios.get(`${URLs.stacjownikAPI}/api/getDispatcherInfo?name=${store.dispatcherStatsName}`)
|
||||||
|
).data;
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
store,
|
store,
|
||||||
|
statsData2,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
cardVisible: false,
|
cardVisible: false,
|
||||||
@@ -72,6 +81,7 @@ export default defineComponent({
|
|||||||
timetables: [] as TimetableHistory[],
|
timetables: [] as TimetableHistory[],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
toggleCard() {
|
toggleCard() {
|
||||||
if (!this.store.dispatcherStatsName) return;
|
if (!this.store.dispatcherStatsName) return;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export const URLs = {
|
export const URLs = {
|
||||||
stacjownikAPI: 'https://stacjownik.eu-4.evennode.com',
|
stacjownikAPI: process.env.VUE_APP_API_DEV != 1 ? 'https://stacjownik.eu-4.evennode.com' : 'http://localhost:3000',
|
||||||
stacjownikAPIDev: 'http://stacjownik-dev.eu-4.evennode.com',
|
stacjownikAPIDev: 'localhost:3000',
|
||||||
// trains: "https://api.td2.info.pl:9640/?method=getTrainsOnline",
|
// 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}`
|
// 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() {
|
connectToWebsocket() {
|
||||||
const socket = io(
|
const socket = io(URLs.stacjownikAPI, {
|
||||||
process.env.NODE_ENV !== 'production' && process.env.VUE_APP_WS_DEV == 1
|
transports: ['websocket', 'polling'],
|
||||||
? URLs.stacjownikAPIDev
|
rememberUpgrade: true,
|
||||||
: URLs.stacjownikAPI,
|
reconnection: true,
|
||||||
{
|
});
|
||||||
transports: ['websocket', 'polling'],
|
|
||||||
rememberUpgrade: true,
|
|
||||||
reconnection: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
socket.on('UPDATE', (data: APIData) => {
|
socket.on('UPDATE', (data: APIData) => {
|
||||||
this.apiData = data;
|
this.apiData = data;
|
||||||
|
|||||||
Reference in New Issue
Block a user