Skip to content

Commit

Permalink
#39 [FIX] 마이페이지 데이터 갱신 오류 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
youjin09222 committed Jan 23, 2025
1 parent c3e3b00 commit f1ce4de
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import com.sopt.core.util.BaseViewModel
import com.sopt.domain.entity.UserEntity
import com.sopt.domain.repository.UserInfoRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import javax.inject.Inject

@HiltViewModel
Expand Down Expand Up @@ -39,7 +41,11 @@ class EditProfileViewModel @Inject constructor(
fun navigateToMyPage() {
saveNickname(_userInfoState.value.nickname)
saveProfileImage(_userInfoState.value.profileImage)
emitSideEffect(EditProfileSideEffect.NavigateToMyPage)
executeInScope {
withContext(Dispatchers.Main) {
emitSideEffect(EditProfileSideEffect.NavigateToMyPage)
}
}
}

fun onNicknameChanged(nickname: String) {
Expand Down

0 comments on commit f1ce4de

Please sign in to comment.