Skip to content

Instantly share code, notes, and snippets.

@mcatta
Last active October 25, 2022 20:05
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 mcatta/084f837cfeac27ffb7e90b7870f7f28f to your computer and use it in GitHub Desktop.
Save mcatta/084f837cfeac27ffb7e90b7870f7f28f to your computer and use it in GitHub Desktop.
inState<GithubState.Load> {
onEnter { state: State<GithubState.Load> ->
val owner = state.snapshot.owner
githubRepository.repositoryByOwner(owner = owner).fold(
ifLeft = {
GithubState.Error(Throwable("Fail"), owner = owner)
},
ifRight = {
GithubState.ContentState(repositories = it, owner = owner)
}
).let { state.override { it } }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment