mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
obsługa niezaładowanych miniaturek pojazdów
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const useJournalFiltersStore = defineStore('journalFiltersStore', {
|
||||
state: () => ({
|
||||
timetableFilters: {
|
||||
|
||||
},
|
||||
}),
|
||||
});
|
||||
+12
-1
@@ -8,14 +8,16 @@ import Station from '../scripts/interfaces/Station';
|
||||
import StationRoutes from '../scripts/interfaces/StationRoutes';
|
||||
import Train from '../scripts/interfaces/Train';
|
||||
import { URLs } from '../scripts/utils/apiURLs';
|
||||
import { getLocoURL, getStatusTimestamp, getStatusID, getScheduledTrain, parseSpawns } from '../scripts/utils/storeUtils';
|
||||
import { getStatusTimestamp, getStatusID, getScheduledTrain, parseSpawns } from '../scripts/utils/storeUtils';
|
||||
import { APIData, StationJSONData, StoreState } from '../scripts/interfaces/store/storeTypes';
|
||||
import packageInfo from '../../package.json';
|
||||
import { RollingStockInfo, RollingStockGithubData } from '../scripts/interfaces/github_api/StockInfoGithubData';
|
||||
|
||||
export const useStore = defineStore('store', {
|
||||
state: () =>
|
||||
({
|
||||
apiData: {} as unknown,
|
||||
rollingStockData: undefined,
|
||||
|
||||
stationList: [],
|
||||
trainList: [],
|
||||
@@ -351,6 +353,7 @@ export const useStore = defineStore('store', {
|
||||
|
||||
async connectToAPI() {
|
||||
await this.fetchStationsGeneralInfo();
|
||||
await this.fetchStockInfoData();
|
||||
|
||||
this.connectToWebsocket();
|
||||
},
|
||||
@@ -361,6 +364,14 @@ export const useStore = defineStore('store', {
|
||||
await this.setOnlineData();
|
||||
},
|
||||
|
||||
async fetchStockInfoData() {
|
||||
try {
|
||||
this.rollingStockData = (await axios.get<RollingStockGithubData>('https://raw.githubusercontent.com/Spythere/api/main/td2/data/stockInfo.json')).data;
|
||||
} catch (error) {
|
||||
console.error('Ups! Wystąpił błąd podczas pobierania informacji o taborze z API:', error);
|
||||
}
|
||||
},
|
||||
|
||||
async setOnlineData() {
|
||||
if (!this.apiData.stations) {
|
||||
this.dataStatuses.sceneries = DataStatus.Error;
|
||||
|
||||
Reference in New Issue
Block a user