Skip to content

Instantly share code, notes, and snippets.

@euri16
Last active June 7, 2025 16:54
Show Gist options
  • Save euri16/bced732966e3ecf8afcec7fca786c684 to your computer and use it in GitHub Desktop.
Save euri16/bced732966e3ecf8afcec7fca786c684 to your computer and use it in GitHub Desktop.
private fun deleteAccount() {
viewModelScope.launch {
// ...
try {
userRepository.deleteAccount()
_uiState.update {
it.copy(
isLoading = false,
effect = UserProfileEffect.NavigateToLogin
)
}
} catch (exception: Exception) {
_uiState.update {
it.copy(
isLoading = false,
effect = UserProfileEffect.ShowError(message = "An error occurred")
)
}
}
}
}
private fun consumeEffect() {
_uiState.update { it.copy(effect = null) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment