Skip to content

Instantly share code, notes, and snippets.

@Elbar
Last active July 21, 2020 09:39
Show Gist options
  • Save Elbar/d908fe0d3391e3c8b92dddaadaed28f6 to your computer and use it in GitHub Desktop.
Save Elbar/d908fe0d3391e3c8b92dddaadaed28f6 to your computer and use it in GitHub Desktop.
package io.example.auth.register
import io.example.base.BaseViewModel
import io.example.extensions.load
import io.example.model.Contact
import io.example.network.Api
import io.example.network.Result
class RegisterViewModel(
private val api: Api
) : BaseViewModel() {
fun register() = vmScope.load {
val response = api.register(contact)
if (response is Result.Success) {
router.navigateTo(screens.registerConfirmation(response.data))
}
}
fun login() = router.navigateTo(screens.login())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment