Last active
July 21, 2020 09:39
-
-
Save Elbar/d908fe0d3391e3c8b92dddaadaed28f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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