oshix
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { weatherApiKey, weatherUrl } from "./index.js";
|
||||
import { log } from "./logger.js";
|
||||
import { ErrorResponse, GeoResponse } from "./types.js";
|
||||
|
||||
export async function ubicacion(lugar: string, limit = '1'): Promise<ErrorResponse | GeoResponse> {
|
||||
const response = await fetch(`${process.env.WEATHER_URL}/geo/1.0/direct?q=${lugar}&limit=${limit}&appid=${process.env.WEATHER_API_KEY}`);
|
||||
export async function ubicacion(lugar: string, limit = 1): Promise<GeoResponse | ErrorResponse> {
|
||||
const response = await fetch(`${weatherUrl}/geo/1.0/direct?q=${lugar}&limit=${limit}&appid=${weatherApiKey}`);
|
||||
log('GET', response);
|
||||
if (!response.ok) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user