Skip to content

Commit

Permalink
Log url
Browse files Browse the repository at this point in the history
  • Loading branch information
timmo001 committed Sep 3, 2024
1 parent a9f1e30 commit d1d3269
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/lib/serverActions/tomorrowio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ export async function getWeatherForecastNow(
): Promise<WeatherForecastErrorResponse | WeatherForecastNow> {
return unstable_cache(
async (): Promise<WeatherForecastErrorResponse | WeatherForecastNow> => {
const response = await fetch(
`https://api.tomorrow.io/v4/weather/realtime?${BASE_PARAMS}&location=${location.latitude},${location.longitude}`,
BASE_REQUEST_OPTIONS,
);
const url = `https://api.tomorrow.io/v4/weather/realtime?${BASE_PARAMS}&location=${location.latitude},${location.longitude}`;
console.log("Get forecast now for location:", location, url);
const response = await fetch(url, BASE_REQUEST_OPTIONS);
const responseData = (await response.json()) as
| WeatherForecastErrorResponse
| WeatherForecastNowResponse;
Expand All @@ -55,10 +54,9 @@ export async function getWeatherForecastHourly(
): Promise<WeatherForecastErrorResponse | WeatherForecastHourly> {
return unstable_cache(
async (): Promise<WeatherForecastErrorResponse | WeatherForecastHourly> => {
const response = await fetch(
`https://api.tomorrow.io/v4/weather/forecast?${BASE_PARAMS}&location=${location.latitude},${location.longitude}&timesteps=1h`,
BASE_REQUEST_OPTIONS,
);
const url = `https://api.tomorrow.io/v4/weather/forecast?${BASE_PARAMS}&location=${location.latitude},${location.longitude}&timesteps=1h`;
console.log("Get hourly forecast for location:", location, url);
const response = await fetch(url, BASE_REQUEST_OPTIONS);
const responseData = (await response.json()) as
| WeatherForecastErrorResponse
| WeatherForecastHourlyResponse;
Expand All @@ -83,10 +81,9 @@ export async function getWeatherForecastDaily(
): Promise<WeatherForecastErrorResponse | WeatherForecastDaily> {
return unstable_cache(
async (): Promise<WeatherForecastErrorResponse | WeatherForecastDaily> => {
const response = await fetch(
`https://api.tomorrow.io/v4/weather/forecast?${BASE_PARAMS}&location=${location.latitude},${location.longitude}&timesteps=1d`,
BASE_REQUEST_OPTIONS,
);
const url = `https://api.tomorrow.io/v4/weather/forecast?${BASE_PARAMS}&location=${location.latitude},${location.longitude}&timesteps=1d`;
console.log("Get daily forecast for location:", location, url);
const response = await fetch(url, BASE_REQUEST_OPTIONS);
const responseData = (await response.json()) as
| WeatherForecastErrorResponse
| WeatherForecastDailyResponse;
Expand Down

0 comments on commit d1d3269

Please sign in to comment.