Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 35c7f847 authored by 62160052's avatar 62160052
Browse files

Call the web service in OverviewViewModel

parent 57285073
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -19,6 +19,9 @@ package com.example.android.marsphotos.overview
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.android.marsphotos.network.MarsApi
import kotlinx.coroutines.launch
/**
* The [ViewModel] that is attached to the [OverviewFragment].
......@@ -42,6 +45,9 @@ class OverviewViewModel : ViewModel() {
* [MarsPhoto] [List] [LiveData].
*/
private fun getMarsPhotos() {
_status.value = "Set the Mars API status response here!"
viewModelScope.launch {
val listResult = MarsApi.retrofitService.getPhotos()
_status.value = listResult
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment