fix: use DEFAULT API from config file
This commit is contained in:
parent
df5cd92321
commit
61a094ecc9
|
@ -1,8 +1,12 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import axios from 'axios';
|
||||
import TableSwitchBody from './table-switch-trip-calendar-body';
|
||||
import PropTypes from 'prop-types';
|
||||
const TablePageBody = ({ agencyIdName }) => {
|
||||
|
||||
import TableSwitchBody from './table-switch-trip-calendar-body';
|
||||
import config from '../config';
|
||||
|
||||
export default function TablePageBody({ agencyIdName }) {
|
||||
|
||||
if(agencyIdName !== undefined){
|
||||
//console.log('TablePageBody agencyIdName:'+JSON.stringify(agencyIdName));
|
||||
//console.log('TablePageBody agencyIdName.length:'+agencyIdName.length);
|
||||
|
@ -12,12 +16,14 @@ const TablePageBody = ({ agencyIdName }) => {
|
|||
//console.log('TablePageBody agencyName:'+agencyName);
|
||||
/*store and initialise data in function component state*/
|
||||
const [tripCalendar, setTripCalendar] = useState({});
|
||||
const getTripCalendar = async () => {
|
||||
|
||||
const getTripCalendar = async () => {
|
||||
try {
|
||||
/*get trip calendar*/
|
||||
const address=`https://v1gtfs.vbn.api.swingbe.de/trip-calendar-by-agency-id?agencyid=${agencyId}`;
|
||||
const address=`${config.API}trip-calendar-by-agency-id?agencyid=${agencyId}`;
|
||||
//console.log('address:'+address);
|
||||
/*TODO handle errors: https://www.valentinog.com/blog/await-react/*/
|
||||
|
||||
/*TODO handle errors: https://www.valentinog.com/blog/await-react/*/
|
||||
const res = await axios.get(address);
|
||||
|
||||
let aryTripCalendar = res.data;
|
||||
|
@ -47,7 +53,7 @@ const TablePageBody = ({ agencyIdName }) => {
|
|||
return <p>Table Page Body loading...</p>
|
||||
}
|
||||
};
|
||||
|
||||
TablePageBody.propTypes = {
|
||||
agencyIdName: PropTypes.object
|
||||
};
|
||||
export default TablePageBody;
|
||||
|
|
|
@ -3,6 +3,7 @@ import axios from 'axios';
|
|||
import PropTypes from 'prop-types';
|
||||
|
||||
import TableSwitchHead from './table-switch-trip-calendar-head';
|
||||
import config from '../config';
|
||||
|
||||
export default function TablePageHead({ agencyIdName }) {
|
||||
|
||||
|
@ -21,9 +22,10 @@ export default function TablePageHead({ agencyIdName }) {
|
|||
|
||||
try {
|
||||
/*get trip calendar*/
|
||||
const address=`https://v1gtfs.vbn.api.swingbe.de/trip-calendar-by-agency-id?agencyid=${agencyId}`;
|
||||
const address=`${config.API}trip-calendar-by-agency-id?agencyid=${agencyId}`;
|
||||
//console.log('TablePageHead address:'+address);
|
||||
/*TODO handle errors: https://www.valentinog.com/blog/await-react/*/
|
||||
|
||||
/*TODO handle errors: https://www.valentinog.com/blog/await-react/*/
|
||||
const res = await axios.get(address);
|
||||
|
||||
let aryTripCalendar = res.data;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import axios from 'axios';
|
||||
|
||||
import OverviewTable from '../components/overview-next-table';
|
||||
import config from '../config';
|
||||
|
||||
|
|
Loading…
Reference in New Issue