Skip to content

Instantly share code, notes, and snippets.

@raamcosta
Created November 27, 2021 15:53
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 raamcosta/c9a1ad01f939557748c522a2a0627032 to your computer and use it in GitHub Desktop.
Save raamcosta/c9a1ad01f939557748c522a2a0627032 to your computer and use it in GitHub Desktop.
class MagicCardSearchViewModel(
private val getCardUseCase: GetMagicCardUseCase
): ViewModel() {
fun onCardSearchClick() = viewModelScope.launch {
when (val result = getCardUseCase(cardName)) {
is Success -> // happy path 🎉
is Error -> {
result.error // 🤔
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment