mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
chore: cleanup
This commit is contained in:
+3
-24
@@ -1,5 +1,5 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { API } from '../typings/api';
|
import { API, APICache } from '../typings/api';
|
||||||
import { Status } from '../typings/common';
|
import { Status } from '../typings/common';
|
||||||
import { StationJSONData } from './typings';
|
import { StationJSONData } from './typings';
|
||||||
import axios, { AxiosInstance } from 'axios';
|
import axios, { AxiosInstance } from 'axios';
|
||||||
@@ -68,17 +68,6 @@ export const useApiStore = defineStore('apiStore', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async fetchActiveData() {
|
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;
|
if (!this.activeData) this.dataStatuses.connection = Status.Data.Loading;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -105,7 +94,7 @@ export const useApiStore = defineStore('apiStore', {
|
|||||||
async fetchStationsGeneralInfo() {
|
async fetchStationsGeneralInfo() {
|
||||||
try {
|
try {
|
||||||
const sceneryData: StationJSONData[] = (
|
const sceneryData: StationJSONData[] = (
|
||||||
await this.client!.get<StationJSONData[]>('api/getSceneries')
|
await this.client!.get<StationJSONData[]>(`api/getSceneries`)
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
this.dataStatuses.sceneries = Status.Data.Loaded;
|
this.dataStatuses.sceneries = Status.Data.Loaded;
|
||||||
@@ -117,16 +106,6 @@ export const useApiStore = defineStore('apiStore', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async fetchVehiclesInfo() {
|
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 {
|
try {
|
||||||
const response = await this.client!.get<API.Vehicles.Response>('api/getVehicles');
|
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;
|
this.dataStatuses.vehicles = Status.Data.Error;
|
||||||
console.error('Ups! Wystąpił błąd podczas pobierania informacji o pojazdach:', error);
|
console.error('Ups! Wystąpił błąd podczas pobierania informacji o pojazdach:', error);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -17,13 +17,13 @@ export namespace API {
|
|||||||
trainsAPI: APIDataStatus;
|
trainsAPI: APIDataStatus;
|
||||||
dispatchersAPI: APIDataStatus;
|
dispatchersAPI: APIDataStatus;
|
||||||
sceneryRequirementsAPI: APIDataStatus;
|
sceneryRequirementsAPI: APIDataStatus;
|
||||||
caches: APICache[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Response {
|
export interface Response {
|
||||||
activeSceneries?: API.ActiveSceneries.Response;
|
activeSceneries?: API.ActiveSceneries.Response;
|
||||||
trains?: API.ActiveTrains.Response;
|
trains?: API.ActiveTrains.Response;
|
||||||
apiStatuses?: APIStatuses;
|
apiStatuses?: APIStatuses;
|
||||||
|
caches: APICache[];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ export default defineComponent({
|
|||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,4 +121,8 @@ button.btn-donation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.count {
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user