Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nimrodda/7a140f29fbc6ce3eb7f66797e538ca3b to your computer and use it in GitHub Desktop.
Save Nimrodda/7a140f29fbc6ce3eb7f66797e538ca3b to your computer and use it in GitHub Desktop.
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