Skip to content

Commit b61c73b

Browse files
committed
Refactor: 로그아웃 중복 클릭 방지 로직 구현
1 parent 0083464 commit b61c73b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingViewModel.kt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,19 @@ class SettingViewModel @Inject constructor(
7777
}
7878

7979
fun logout() {
80+
if (container.stateFlow.value.loading) return
81+
8082
sendIntent(SettingIntent.HideConfirmDialog)
8183
viewModelScope.launch {
8284
sendIntent(SettingIntent.LogoutLoading)
83-
logoutUseCase().onSuccess {
84-
sendIntent(SettingIntent.LogoutSuccess)
85-
}.onFailure {
86-
sendIntent(SettingIntent.LogoutFailure)
87-
}
85+
logoutUseCase().fold(
86+
onSuccess = {
87+
sendIntent(SettingIntent.LogoutSuccess)
88+
},
89+
onFailure = {
90+
sendIntent(SettingIntent.LogoutFailure)
91+
},
92+
)
8893
}
8994
}
9095

0 commit comments

Comments
 (0)