Skip to content

Commit

Permalink
fix: remove redundant try-catch in deleteUserProfile of `UserViewMo…
Browse files Browse the repository at this point in the history
…del`
  • Loading branch information
Harrish92 committed Nov 21, 2024
1 parent cc7f0b1 commit 76887ff
Showing 1 changed file with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,17 @@ class UserViewModel(private val userRepository: UserRepositorySupabase) : ViewMo
}
) {
viewModelScope.launch {
try {
userRepository.deleteUserProfile(
idUser,
onSuccess = {
Log.d(TAG, "deleteAccount: Success")
_user.value = null
onSuccess()
},
onFailure = { exception ->
Log.d(TAG, "deleteAccount : fail to delete user: ${exception.message}")
onFailure(exception)
})
} catch (e: Exception) {
onFailure(e)
}
userRepository.deleteUserProfile(
idUser,
onSuccess = {
Log.d(TAG, "deleteAccount: Success")
_user.value = null
onSuccess()
},
onFailure = { exception ->
Log.d(TAG, "deleteAccount : fail to delete user: ${exception.message}")
onFailure(exception)
})
}
}
}

0 comments on commit 76887ff

Please sign in to comment.