Skip to content

Commit 997a706

Browse files
authored
Merge pull request #60 from YAPP-Github/feature/#59-mypage-profile-api
[Feature/#59] 마이페이지 유저 프로필 API 연동
2 parents cfc7f70 + d9fbc5f commit 997a706

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

data/src/main/java/com/threegap/bitnagil/data/emotion/service/EmotionService.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import com.threegap.bitnagil.network.model.BaseResponse
88
import retrofit2.http.Body
99
import retrofit2.http.GET
1010
import retrofit2.http.POST
11-
import retrofit2.http.Query
11+
import retrofit2.http.Path
1212

1313
interface EmotionService {
1414
@GET("/api/v1/emotion-marbles")
@@ -19,8 +19,8 @@ interface EmotionService {
1919
@Body request: RegisterEmotionRequest,
2020
): BaseResponse<RegisterEmotionResponse>
2121

22-
@GET("/api/v1/emotion-marbles/me")
22+
@GET("/api/v1/emotion-marbles/{searchDate}")
2323
suspend fun getMyEmotionMarble(
24-
@Query("searchDate") date: String,
24+
@Path("searchDate") date: String,
2525
): BaseResponse<MyEmotionResponseDto>
2626
}

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)