Files
Astronome/frontend/src/hooks/useWeather.ts
T
2026-04-10 00:02:40 +02:00

20 lines
431 B
TypeScript

import { useQuery } from '@tanstack/react-query';
import { api } from '../api';
export function useWeather() {
return useQuery({
queryKey: ['weather'],
queryFn: () => api.weather.get(),
staleTime: 15 * 60_000,
refetchInterval: 15 * 60_000,
});
}
export function useForecast() {
return useQuery({
queryKey: ['forecast'],
queryFn: () => api.weather.forecast(),
staleTime: 3 * 60 * 60_000,
});
}