Skip to content

Instantly share code, notes, and snippets.

@MkhytarMkhoian
Last active May 16, 2024 12:34
Show Gist options
  • Save MkhytarMkhoian/4bef56912dcbc4794c2449bf10b1a8b4 to your computer and use it in GitHub Desktop.
Save MkhytarMkhoian/4bef56912dcbc4794c2449bf10b1a8b4 to your computer and use it in GitHub Desktop.
private fun fetchFares() = intent {
reduce { state.copy(status = ScreenContentStatus.Loading) }
executeUseCase { getFaresByIdUseCase(ryderId).asPresentation() }
.onSuccess { fares ->
reduce {
state.copy(
status = ScreenContentStatus.Success,
fares = fares
)
}
}
.onFailure {
reduce { state.copy(status = ScreenContentStatus.Failure) }
postSideEffect(FareListEffect.ShowGeneralNetworkError)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment