From b9ba70cac523fbe3b20017cff344555b34f3ca37 Mon Sep 17 00:00:00 2001 From: "Begerad, Stefan" Date: Wed, 22 Jun 2022 12:41:59 +0200 Subject: [PATCH] feat(fare-zones-table): switch from tarifmatrix to data.vbn API --- .../src/component/fare-zones-table.js | 28 ++++++++++++---- fare-zones-table/src/component/fare-zones.js | 33 +++++++++---------- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/fare-zones-table/src/component/fare-zones-table.js b/fare-zones-table/src/component/fare-zones-table.js index a1b6496..80fa155 100644 --- a/fare-zones-table/src/component/fare-zones-table.js +++ b/fare-zones-table/src/component/fare-zones-table.js @@ -6,13 +6,27 @@ class FareZonesTable extends Component { return ( {this.props.obj.id} - {this.props.obj.extern} - {this.props.obj.type} - {this.props.obj.intern} - {this.props.obj.name} - {this.props.obj.shortName} - {this.props.obj.validFrom} - {this.props.obj.validUnit} + {this.props.obj.active ? 'true' : 'false'} + {this.props.obj.lon} + {this.props.obj.lat} + {this.props.obj.stop_long_name} + {this.props.obj.stop_name} + {this.props.obj.stop_name_extern} + {this.props.obj.fare_zone_1} + + {this.props.obj.fare_zone_2 ? this.props.obj.fare_zone_2 : 'null'} + + + {this.props.obj.fare_zone_3 ? this.props.obj.fare_zone_3 : 'null'} + + + {this.props.obj.fare_zone_4 ? this.props.obj.fare_zone_4 : 'null'} + + {this.props.obj.valid_from} + + {this.props.obj.valid_until ? this.props.obj.valid_until : 'null'} + + {this.props.obj.last_modified} ); } diff --git a/fare-zones-table/src/component/fare-zones.js b/fare-zones-table/src/component/fare-zones.js index e345b3e..97c6ac0 100644 --- a/fare-zones-table/src/component/fare-zones.js +++ b/fare-zones-table/src/component/fare-zones.js @@ -9,20 +9,13 @@ export default class FareZones extends Component { } componentDidMount () { - axios.defaults.baseURL = 'https://tarifmatrix.vbn.de:4445'; + axios.defaults.baseURL = 'https://data.vbn.de'; axios.defaults.headers.get['Content-Type'] = 'application/json;charset=utf-8'; axios.defaults.headers.get['Access-Control-Allow-Origin'] = '*'; axios - .get('fares/areas/info', { - // Axios looks for the `auth` option, and, if it is set, formats a - // basic auth header for you automatically. - auth: { - username: 'tbd', - password: 'tbd' - } - }) + .get('/data/stops') .then((res) => { this.setState({ usersCollection: res.data }); }) @@ -44,14 +37,20 @@ export default class FareZones extends Component { - - - - - - - - + + + + + + + + + + + + + + {this.dataTable()}
IDExternTypeInternNameShort NameValid FromValid Toidactivelonlatstop_long_namestop_namestop_name_externfare_zone_1fare_zone_2fare_zone_3fare_zone_4valid_fromvalid_untillast_modified