mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
DEV: zmiana w pobieraniu danych z API
This commit is contained in:
@@ -19,7 +19,7 @@ export default interface Station {
|
||||
stationLines: string;
|
||||
stationProject: string;
|
||||
|
||||
reqLevel: string;
|
||||
reqLevel: number;
|
||||
supportersOnly: boolean;
|
||||
|
||||
SBL: string;
|
||||
|
||||
@@ -5,11 +5,8 @@ import StorageManager from './storageManager';
|
||||
const sortStations = (a: Station, b: Station, sorter: { index: number; dir: number }) => {
|
||||
switch (sorter.index) {
|
||||
case 1:
|
||||
const aLevel = a.reqLevel == "" ? -1 : parseInt(a.reqLevel);
|
||||
const bLevel = b.reqLevel == "" ? -1 : parseInt(b.reqLevel);
|
||||
|
||||
if (aLevel > bLevel) return sorter.dir;
|
||||
if (aLevel < bLevel) return -sorter.dir;
|
||||
if (a.reqLevel > b.reqLevel) return sorter.dir;
|
||||
if (a.reqLevel < b.reqLevel) return -sorter.dir;
|
||||
|
||||
break;
|
||||
case 2:
|
||||
@@ -85,9 +82,9 @@ const filterStations = (station: Station, filters: Filter) => {
|
||||
if (filters['real'] && station.stationLines != '') return returnMode;
|
||||
if (filters['fictional'] && station.stationLines == '') return returnMode;
|
||||
|
||||
if (station.reqLevel == '-1') return true;
|
||||
if (parseInt(station.reqLevel) < filters['minLevel']) return returnMode;
|
||||
if (parseInt(station.reqLevel) > filters['maxLevel']) return returnMode;
|
||||
if (station.reqLevel == -1) return true;
|
||||
if (station.reqLevel < filters['minLevel']) return returnMode;
|
||||
if (station.reqLevel > filters['maxLevel']) return returnMode;
|
||||
|
||||
if (filters['no-1track'] && (station.routes.oneWay.catenary != 0 || station.routes.oneWay.noCatenary != 0)) return returnMode;
|
||||
if (filters['no-2track'] && (station.routes.twoWay.catenary != 0 || station.routes.twoWay.noCatenary != 0)) return returnMode;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export const URLs = {
|
||||
sceneryData: "https://spythere.github.io/api/stationData.json",
|
||||
sceneryDataDev: "http://127.0.0.1:8000/data",
|
||||
stations: "https://api.td2.info.pl:9640/?method=getStationsOnline",
|
||||
trains: "https://api.td2.info.pl:9640/?method=getTrainsOnline",
|
||||
dispatchers: "https://api.td2.info.pl:9640/?method=readFromSWDR&value=getDispatcherStatusList%3B1",
|
||||
|
||||
Reference in New Issue
Block a user