chore: cleanup

This commit is contained in:
2024-09-05 15:34:11 +02:00
parent 7b3dcea89e
commit 55b4732992
3 changed files with 8 additions and 26 deletions
+3 -24
View File
@@ -1,5 +1,5 @@
import { defineStore } from 'pinia';
import { API } from '../typings/api';
import { API, APICache } from '../typings/api';
import { Status } from '../typings/common';
import { StationJSONData } from './typings';
import axios, { AxiosInstance } from 'axios';
@@ -68,17 +68,6 @@ export const useApiStore = defineStore('apiStore', {
},
async fetchActiveData() {
// if (import.meta.env.VITE_API_ACTIVE_DATA_MODE == 'mocking') {
// import('../../tests/data/getActiveData.json').then((data) => {
// console.warn('activeData: mocking mode');
// this.activeData = data.default as API.ActiveData.Response;
// this.dataStatuses.connection = Status.Data.Loaded;
// });
// return;
// }
if (!this.activeData) this.dataStatuses.connection = Status.Data.Loading;
try {
@@ -105,7 +94,7 @@ export const useApiStore = defineStore('apiStore', {
async fetchStationsGeneralInfo() {
try {
const sceneryData: StationJSONData[] = (
await this.client!.get<StationJSONData[]>('api/getSceneries')
await this.client!.get<StationJSONData[]>(`api/getSceneries`)
).data;
this.dataStatuses.sceneries = Status.Data.Loaded;
@@ -117,16 +106,6 @@ export const useApiStore = defineStore('apiStore', {
},
async fetchVehiclesInfo() {
// if (import.meta.env.VITE_API_VEHICLES_MODE == 'mocking') {
// import('../../tests/data/vehicles.json').then((data) => {
// console.warn('vehicles.json: mocking mode');
// this.vehiclesData = data.default;
// this.dataStatuses.vehicles = Status.Data.Loaded;
// });
// return;
// }
try {
const response = await this.client!.get<API.Vehicles.Response>('api/getVehicles');
@@ -136,6 +115,6 @@ export const useApiStore = defineStore('apiStore', {
this.dataStatuses.vehicles = Status.Data.Error;
console.error('Ups! Wystąpił błąd podczas pobierania informacji o pojazdach:', error);
}
}
},
}
});
+1 -1
View File
@@ -17,13 +17,13 @@ export namespace API {
trainsAPI: APIDataStatus;
dispatchersAPI: APIDataStatus;
sceneryRequirementsAPI: APIDataStatus;
caches: APICache[];
}
export interface Response {
activeSceneries?: API.ActiveSceneries.Response;
trains?: API.ActiveTrains.Response;
apiStatuses?: APIStatuses;
caches: APICache[];
}
}
+4 -1
View File
@@ -101,7 +101,6 @@ export default defineComponent({
gap: 0.5em;
position: relative;
margin-bottom: 0.5em;
}
@@ -122,4 +121,8 @@ button.btn-donation {
}
}
}
.count {
padding: 0.5em;
}
</style>