Skip to content

Commit

Permalink
fix: new agencies should appear in the dashboard (#797)
Browse files Browse the repository at this point in the history
Co-authored-by: Noam Gaash <[email protected]>
Co-authored-by: Noam Gaash <[email protected]>
  • Loading branch information
3 people authored Jun 21, 2024
1 parent c090ff2 commit ea7551e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/agencyList.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react'
import moment from 'moment'
import { BASE_PATH } from './apiConfig'
export interface Agency {
date: string // example - "2019-07-01"
Expand All @@ -14,7 +15,8 @@ let agencyList: Agency[]
*/
export default async function getAgencyList(): Promise<Agency[]> {
if (!agencyList) {
const response = await fetch(`${BASE_PATH}/gtfs_agencies/list`)
const yesterday = moment().subtract(1, 'day').format('YYYY-MM-DD')
const response = await fetch(`${BASE_PATH}/gtfs_agencies/list?date_from=${yesterday}`)
const data = (await response.json()) as Awaited<Agency[]>
agencyList = data.filter(Boolean) // filter empty entries
}
Expand Down

0 comments on commit ea7551e

Please sign in to comment.