Uaktualnienie do wersji API

This commit is contained in:
2022-06-21 23:37:11 +02:00
parent 9e18d8bf9a
commit b91e58f9af
8 changed files with 51 additions and 360 deletions
+11 -4
View File
@@ -37,7 +37,7 @@ export const useStore = defineStore('store', {
stationCount: 0,
webSocket: undefined,
dispatcherStatsName: '',
dispatcherStatsData: undefined,
@@ -258,8 +258,8 @@ export const useStore = defineStore('store', {
async fetchStationsGeneralInfo() {
const sceneryData: StationJSONData[] = await (
await axios.get(`${URLs.stacjownikAPI}/api/getSceneryData?timestamp=${Math.floor(Date.now() / 1800000)}`)
).data.response;
await axios.get(`${URLs.stacjownikAPI}/api/getSceneries?timestamp=${Math.floor(Date.now() / 1800000)}`)
).data;
if (!sceneryData) {
this.dataStatuses.sceneries = DataStatus.Error;
@@ -342,9 +342,16 @@ export const useStore = defineStore('store', {
socket.on('UPDATE', (data: APIData) => {
this.apiData = data;
this.setOnlineData();
console.log(data);
});
socket.emit('FETCH_DATA', {}, (data: APIData) => {
this.apiData = data;
this.setOnlineData();
});
socket.emit('connection');
this.webSocket = socket;
},