Instaid of getting the species, get the pokemon itself

This commit is contained in:
Joren 2024-04-29 16:30:09 +02:00
parent 7b3131d510
commit f7bd501921
Signed by untrusted user who does not match committer: Joren
GPG Key ID: 280E33DFBC0F1B55

View File

@ -19,13 +19,13 @@ data class PokemonSpecies(
@SerializedName("url") val url: String
)
data class PokemonSpeciesResponse(
data class PokemonResponse(
@SerializedName("results") val results: List<PokemonSpecies>
)
interface PokeApiService {
@GET("pokemon-species/?offset=0&limit=1025")
suspend fun getPokemonSpecies(): PokemonSpeciesResponse
@GET("pokemon/?offset=0&limit=1025")
suspend fun getPokemon(): PokemonResponse
}
class PokeSearchViewModel : ViewModel() {
@ -48,7 +48,7 @@ class PokeSearchViewModel : ViewModel() {
private fun fetchPokemonSpecies() {
viewModelScope.launch {
try {
val response = service.getPokemonSpecies()
val response = service.getPokemon()
_initialPokemonList.value = response.results
_filteredPokemonList.value = listOf(PokemonSpecies("Please enter a search term", ""));
} catch (e: IOException) {