Refactor API clients and update project structure for TimeToLeave
This commit is contained in:
@@ -61,7 +61,7 @@ function parseHafasJourneys(json: unknown, hafasDate: string, queryDate: Date):
|
||||
});
|
||||
}
|
||||
|
||||
export function useJourneys(fromStationExtId: string | null, toStationExtId: string | null, date: Date) {
|
||||
export function useJourneys(fromStationExtId: string | null, toStationExtId: string | null, date: Date, refreshKey = 0) {
|
||||
const [journeys, setJourneys] = useState<Journey[]>([]);
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -127,7 +127,7 @@ export function useJourneys(fromStationExtId: string | null, toStationExtId: str
|
||||
return () => {
|
||||
isMounted = false;
|
||||
};
|
||||
}, [fromStationExtId, toStationExtId, date]);
|
||||
}, [fromStationExtId, toStationExtId, date, refreshKey]);
|
||||
|
||||
return { journeys, loading, error };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user