Created
March 19, 2019 11:15
-
-
Save Nimrodda/7a140f29fbc6ce3eb7f66797e538ca3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DetailViewModel( | |
private val githubApi: GithubApi, | |
private val handle: SavedStateHandle | |
) : ViewModel() { | |
fun loadData() { | |
val id = handle["id"] ?: "default" | |
viewModelScope.launch { | |
val response = githubApi.getCommit(id) | |
// Handle response | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment