Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.threegap.bitnagil.network.model.BaseResponse
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query
import retrofit2.http.Path

interface EmotionService {
@GET("/api/v1/emotion-marbles")
Expand All @@ -19,8 +19,8 @@ interface EmotionService {
@Body request: RegisterEmotionRequest,
): BaseResponse<RegisterEmotionResponse>

@GET("/api/v1/emotion-marbles/me")
@GET("/api/v1/emotion-marbles/{searchDate}")
suspend fun getMyEmotionMarble(
@Query("searchDate") date: String,
@Path("searchDate") date: String,
): BaseResponse<MyEmotionResponseDto>
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import com.threegap.bitnagil.network.model.BaseResponse
import retrofit2.http.GET

interface UserService {
@GET("/api/v1/users/nickname")
@GET("/api/v1/users/infos")
suspend fun fetchUserProfile(): BaseResponse<UserProfileResponseDto>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.threegap.bitnagil.presentation.mypage

import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.viewModelScope
import com.threegap.bitnagil.domain.user.usecase.FetchUserProfileUseCase
import com.threegap.bitnagil.presentation.common.mviviewmodel.MviViewModel
import com.threegap.bitnagil.presentation.mypage.model.MyPageIntent
import com.threegap.bitnagil.presentation.mypage.model.MyPageSideEffect
Expand All @@ -14,6 +15,7 @@ import javax.inject.Inject
@HiltViewModel
class MyPageViewModel @Inject constructor(
savedStateHandle: SavedStateHandle,
private val fetchUserProfileUseCase: FetchUserProfileUseCase,
) : MviViewModel<MyPageState, MyPageSideEffect, MyPageIntent>(
MyPageState.Init,
savedStateHandle,
Expand All @@ -24,7 +26,18 @@ class MyPageViewModel @Inject constructor(

private fun loadMyPageInfo() {
viewModelScope.launch {
sendIntent(MyPageIntent.LoadMyPageSuccess(name = "이름", profileUrl = "profileUrl"))
fetchUserProfileUseCase().fold(
onSuccess = {
sendIntent(
MyPageIntent.LoadMyPageSuccess(
name = it.nickname,
profileUrl = "profileUrl",
),
)
},
onFailure = {
},
)
}
Comment thread
wjdrjs00 marked this conversation as resolved.
}

Expand Down