Instaid of getting the species, get the pokemon itself
This commit is contained in:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user