File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
data/src/main/java/com/threegap/bitnagil/data
presentation/src/main/java/com/threegap/bitnagil/presentation/mypage Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import com.threegap.bitnagil.network.model.BaseResponse
88import retrofit2.http.Body
99import retrofit2.http.GET
1010import retrofit2.http.POST
11- import retrofit2.http.Query
11+ import retrofit2.http.Path
1212
1313interface 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}
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ import com.threegap.bitnagil.network.model.BaseResponse
55import retrofit2.http.GET
66
77interface UserService {
8- @GET(" /api/v1/users/nickname " )
8+ @GET(" /api/v1/users/infos " )
99 suspend fun fetchUserProfile (): BaseResponse <UserProfileResponseDto >
1010}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package com.threegap.bitnagil.presentation.mypage
22
33import androidx.lifecycle.SavedStateHandle
44import androidx.lifecycle.viewModelScope
5+ import com.threegap.bitnagil.domain.user.usecase.FetchUserProfileUseCase
56import com.threegap.bitnagil.presentation.common.mviviewmodel.MviViewModel
67import com.threegap.bitnagil.presentation.mypage.model.MyPageIntent
78import com.threegap.bitnagil.presentation.mypage.model.MyPageSideEffect
@@ -14,6 +15,7 @@ import javax.inject.Inject
1415@HiltViewModel
1516class 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
You can’t perform that action at this time.
0 commit comments