Skip to content

Commit df1297d

Browse files
committed
feat: update fetcher
1 parent da2b145 commit df1297d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Roadmap/20 - PETICIONES HTTP/typescript/EdiedRamos.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class Pokemon {
9393
}
9494

9595
class Fetcher {
96-
static async customFetch<T>(endpoint: string): Promise<T> {
96+
static async get<T>(endpoint: string): Promise<T> {
9797
const response = await fetch(endpoint);
9898
const data = (await response.json()) as T;
9999
return data;
@@ -106,23 +106,23 @@ class PokemonFetcher {
106106
static async fetchPokemonInformation(
107107
pokemonTarget: string
108108
): Promise<PokemonResponse> {
109-
return await Fetcher.customFetch<PokemonResponse>(
109+
return await Fetcher.get<PokemonResponse>(
110110
`${this.baseUrl}pokemon/${pokemonTarget}`
111111
);
112112
}
113113

114114
static async fetchPokemonSpecies(
115115
pokemonTarget: string
116116
): Promise<PokemonSpeciesResponse> {
117-
return await Fetcher.customFetch<PokemonSpeciesResponse>(
117+
return await Fetcher.get<PokemonSpeciesResponse>(
118118
`${this.baseUrl}pokemon-species/${pokemonTarget}`
119119
);
120120
}
121121

122122
static async fetchPokemonEvolutionFromURL(
123123
evolutionURL: string
124124
): Promise<PokemonEvolutionResponse> {
125-
return await Fetcher.customFetch<PokemonEvolutionResponse>(evolutionURL);
125+
return await Fetcher.get<PokemonEvolutionResponse>(evolutionURL);
126126
}
127127
}
128128

0 commit comments

Comments
 (0)