@@ -5,11 +5,14 @@ import androidx.lifecycle.viewModelScope
5
5
import com.idle.binding.EventHelper
6
6
import com.idle.binding.MainEvent
7
7
import com.idle.binding.ToastType.SUCCESS
8
+ import com.idle.center.pending.R
8
9
import com.idle.domain.model.error.ErrorHelper
9
10
import com.idle.domain.model.profile.CenterManagerAccountStatus
10
11
import com.idle.domain.usecase.auth.LogoutCenterUseCase
11
12
import com.idle.domain.usecase.auth.SendCenterVerificationRequestUseCase
12
13
import com.idle.domain.usecase.profile.GetCenterStatusUseCase
14
+ import com.idle.navigation.DeepLinkDestination
15
+ import com.idle.navigation.NavigationEvent
13
16
import dagger.hilt.android.lifecycle.HiltViewModel
14
17
import kotlinx.coroutines.delay
15
18
import kotlinx.coroutines.flow.MutableStateFlow
@@ -32,7 +35,7 @@ class CenterPendingViewModel @Inject constructor(
32
35
33
36
private var pollingJob = MutableStateFlow (false )
34
37
35
- init {
38
+ init {
36
39
subscribeCenterStatus()
37
40
}
38
41
@@ -43,7 +46,7 @@ class CenterPendingViewModel @Inject constructor(
43
46
internal fun logout () = viewModelScope.launch {
44
47
logoutCenterUseCase().onSuccess {
45
48
navigationHelper.navigateTo(
46
- com.idle.navigation. NavigationEvent .NavigateToAuthWithClearBackStack (
49
+ NavigationEvent .NavigateToAuthWithClearBackStack (
47
50
toastMsg = " 로그아웃이 완료되었습니다." ,
48
51
toastType = " SUCCESS"
49
52
)
@@ -73,7 +76,14 @@ class CenterPendingViewModel @Inject constructor(
73
76
when (it.centerManagerAccountStatus) {
74
77
CenterManagerAccountStatus .APPROVED -> {
75
78
pollingJob.emit(false )
79
+ navigationHelper.navigateTo(
80
+ NavigationEvent .NavigateTo (
81
+ destination = DeepLinkDestination .CenterHome ,
82
+ popUpTo = R .id.centerPendingFragment,
83
+ )
84
+ )
76
85
86
+ eventHelper.sendEvent(MainEvent .ShowToast (" 센터 인증이 완료되었습니다." , SUCCESS ))
77
87
}
78
88
79
89
else -> Unit
0 commit comments