diff --git a/app/actions.ts b/app/actions.ts index 9da3589..fb2f2c4 100644 --- a/app/actions.ts +++ b/app/actions.ts @@ -1,5 +1,4 @@ 'use server' - import { Forecast, LocationType, coordType } from "@/types/types"; //takes address and returns coords in obj as {lat: number, lng: number} @@ -14,9 +13,10 @@ export async function getLocation(searchLocation: string): Promise{ return data.results[0].geometry.location; } +// takes coordinates in coordType format and returns json with weather forecast. export async function getForecast(geoLocation: coordType): Promise { const { lat, lng } = geoLocation; - const appId = "546911d860cb81f16585f7973b394b70"; + const appId = '546911d860cb81f16585f7973b394b70'; const res = await fetch( `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lng}&appid=${appId}` );