Skip to content

Commit d61c6a9

Browse files
committed
Feat: 마이페이지 API 연동
- API endpoint 수정
1 parent da4e368 commit d61c6a9

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

data/src/main/java/com/threegap/bitnagil/data/user/service/UserService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ import com.threegap.bitnagil.network.model.BaseResponse
55
import retrofit2.http.GET
66

77
interface UserService {
8-
@GET("/api/v1/users/nickname")
8+
@GET("/api/v1/users/infos")
99
suspend fun fetchUserProfile(): BaseResponse<UserProfileResponseDto>
1010
}

presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/MyPageViewModel.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.threegap.bitnagil.presentation.mypage
22

33
import androidx.lifecycle.SavedStateHandle
44
import androidx.lifecycle.viewModelScope
5+
import com.threegap.bitnagil.domain.user.usecase.FetchUserProfileUseCase
56
import com.threegap.bitnagil.presentation.common.mviviewmodel.MviViewModel
67
import com.threegap.bitnagil.presentation.mypage.model.MyPageIntent
78
import com.threegap.bitnagil.presentation.mypage.model.MyPageSideEffect
@@ -14,6 +15,7 @@ import javax.inject.Inject
1415
@HiltViewModel
1516
class MyPageViewModel @Inject constructor(
1617
savedStateHandle: SavedStateHandle,
18+
private val fetchUserProfileUseCase: FetchUserProfileUseCase,
1719
) : MviViewModel<MyPageState, MyPageSideEffect, MyPageIntent>(
1820
MyPageState.Init,
1921
savedStateHandle,
@@ -24,7 +26,18 @@ class MyPageViewModel @Inject constructor(
2426

2527
private fun loadMyPageInfo() {
2628
viewModelScope.launch {
27-
sendIntent(MyPageIntent.LoadMyPageSuccess(name = "이름", profileUrl = "profileUrl"))
29+
fetchUserProfileUseCase().fold(
30+
onSuccess = {
31+
sendIntent(
32+
MyPageIntent.LoadMyPageSuccess(
33+
name = it.nickname,
34+
profileUrl = "profileUrl",
35+
),
36+
)
37+
},
38+
onFailure = {
39+
},
40+
)
2841
}
2942
}
3043

0 commit comments

Comments
 (0)