Created
April 25, 2021 18:32
-
-
Save Ochornma/7c10e90203feff792e07b464ac0144e3 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
| class VerifyBVNViewModel( private val repository: SoftKashRepository | |
| ) : ViewModel() { | |
| private val viewModelJob = SupervisorJob() | |
| private val viewModelScope = CoroutineScope(viewModelJob + Dispatchers.Main) | |
| fun getUnverifiedBVN(result: (Response<UnverifiedResponse>) -> Unit){ | |
| viewModelScope.launch { | |
| repository.getUnverifiedBVN{ | |
| result(it) | |
| } | |
| } | |
| } | |
| fun verifyBVN(userId: RequestBody, adminId: RequestBody, result: (Response<VerifyResponse>) -> Unit){ | |
| viewModelScope.launch { | |
| repository.verifyBVN(userId, adminId){ | |
| result(it) | |
| } | |
| } | |
| } | |
| override fun onCleared() { | |
| super.onCleared() | |
| viewModelJob.cancel() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment