elizarov
04/19/2017, 12:50 PMprivate fun doPostThought() {
postThoughtPrepare().then({ t ->
postThought(props.replyTo?.id, state.text, t).then({ thought ->
onSubmitted(thought)
}, { onFailed(it) }).catch { onFailed(it) }
}, { onFailed(it) }).catch { onFailed(it) }
}
(watch the catch!) gets replaced with:
private fun doPostThought() {
async {
val token = postThoughtPrepare()
val thought = postThought(props.replyTo?.id, state.text, token)
onSubmitted(thought)
}.catch { err -> onFailed(err) }
}