use proxy for local development
This commit is contained in:
parent
74a5cf7cbf
commit
c6d481556b
|
@ -45,5 +45,6 @@
|
||||||
"last 1 firefox version",
|
"last 1 firefox version",
|
||||||
"last 1 safari version"
|
"last 1 safari version"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"proxy": "http://localhost:8000"
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ function Station() {
|
||||||
useQueryClient()
|
useQueryClient()
|
||||||
const stopQuery = useQuery({
|
const stopQuery = useQuery({
|
||||||
queryKey: ['stop', stopId],
|
queryKey: ['stop', stopId],
|
||||||
queryFn: () => fetch(`http://localhost:8000/api/gtfs/stop/${stopId}/`)
|
queryFn: () => fetch(`/api/gtfs/stop/${stopId}/`)
|
||||||
.then(response => response.json()),
|
.then(response => response.json()),
|
||||||
enabled: !!stopId,
|
enabled: !!stopId,
|
||||||
})
|
})
|
||||||
|
|
|
@ -62,7 +62,7 @@ function TrainsTableBody({stop, date, time, tableType}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTrains() {
|
function updateTrains() {
|
||||||
return fetch(`http://localhost:8000/api/station/next_${tableType}/?stop_id=${stop.id}&date=${date}&time=${time}&offset=${0}&limit=${20}`)
|
return fetch(`/api/station/next_${tableType}/?stop_id=${stop.id}&date=${date}&time=${time}&offset=${0}&limit=${20}`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => data.results)
|
.then(data => data.results)
|
||||||
.then(data => [...data])
|
.then(data => [...data])
|
||||||
|
@ -98,7 +98,7 @@ function TrainsTableBody({stop, date, time, tableType}) {
|
||||||
function TrainRow({train, tableType}) {
|
function TrainRow({train, tableType}) {
|
||||||
const tripQuery = useQuery({
|
const tripQuery = useQuery({
|
||||||
queryKey: ['trip', train.trip],
|
queryKey: ['trip', train.trip],
|
||||||
queryFn: () => fetch(`http://localhost:8000/api/gtfs/trip/${train.trip}/`)
|
queryFn: () => fetch(`/api/gtfs/trip/${train.trip}/`)
|
||||||
.then(response => response.json()),
|
.then(response => response.json()),
|
||||||
enabled: !!train.trip,
|
enabled: !!train.trip,
|
||||||
})
|
})
|
||||||
|
@ -106,7 +106,7 @@ function TrainRow({train, tableType}) {
|
||||||
|
|
||||||
const routeQuery = useQuery({
|
const routeQuery = useQuery({
|
||||||
queryKey: ['route', trip.route],
|
queryKey: ['route', trip.route],
|
||||||
queryFn: () => fetch(`http://localhost:8000/api/gtfs/route/${trip.route}/`)
|
queryFn: () => fetch(`/api/gtfs/route/${trip.route}/`)
|
||||||
.then(response => response.json()),
|
.then(response => response.json()),
|
||||||
enabled: !!trip.route,
|
enabled: !!trip.route,
|
||||||
})
|
})
|
||||||
|
@ -115,7 +115,7 @@ function TrainRow({train, tableType}) {
|
||||||
|
|
||||||
const stopTimesQuery = useQuery({
|
const stopTimesQuery = useQuery({
|
||||||
queryKey: ['stop_times', trip.id],
|
queryKey: ['stop_times', trip.id],
|
||||||
queryFn: () => fetch(`http://localhost:8000/api/gtfs/stop_time/?trip=${trip.id}&order=stop_sequence&limit=1000`)
|
queryFn: () => fetch(`/api/gtfs/stop_time/?trip=${trip.id}&order=stop_sequence&limit=1000`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => data.results),
|
.then(data => data.results),
|
||||||
enabled: !!trip.id,
|
enabled: !!trip.id,
|
||||||
|
@ -126,7 +126,7 @@ function TrainRow({train, tableType}) {
|
||||||
const stopQueries = useQueries({
|
const stopQueries = useQueries({
|
||||||
queries: stopIds.map(stopId => ({
|
queries: stopIds.map(stopId => ({
|
||||||
queryKey: ['stop', stopId],
|
queryKey: ['stop', stopId],
|
||||||
queryFn: () => fetch(`http://localhost:8000/api/gtfs/stop/${stopId}/`)
|
queryFn: () => fetch(`/api/gtfs/stop/${stopId}/`)
|
||||||
.then(response => response.json()),
|
.then(response => response.json()),
|
||||||
enabled: !!stopId,
|
enabled: !!stopId,
|
||||||
})),
|
})),
|
||||||
|
|
Loading…
Reference in New Issue