From 66d98ee8682f46beb432a3400ad549e1e95c1913 Mon Sep 17 00:00:00 2001 From: iliasbo Date: Thu, 17 Sep 2026 14:19:43 +0200 Subject: [PATCH] fix(api): update getPokemonByID guard to reject id < 1 (#29) --- src/api/pokemon.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/pokemon.ts b/src/api/pokemon.ts index 166e6cc..c97968f 100644 --- a/src/api/pokemon.ts +++ b/src/api/pokemon.ts @@ -1,5 +1,5 @@ export async function getPokemonByID(id: number) { - if (id < 0 || id > 1025) { + if (id < 1 || id > 1025) { throw new Error("Invalid parameter provided (0 < id <= 1025)"); } const res = await fetch(`https://pokeapi.co/api/v2/pokemon/${id}`);