Skip to content

Commit

Permalink
[FEAT/#106] 함수명 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Jul 17, 2024
1 parent 3601c50 commit 6a8c7bc
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package com.terning.data.datasource
import com.terning.data.dto.NonDataBaseResponse

interface MyPageDataSource {
suspend fun patchLogout(): NonDataBaseResponse
suspend fun postLogout(): NonDataBaseResponse
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import javax.inject.Inject
class MyPageDataSourceImpl @Inject constructor(
private val myPageService: MyPageService
) : MyPageDataSource {
override suspend fun patchLogout(): NonDataBaseResponse = myPageService.patchLogout()
override suspend fun postLogout(): NonDataBaseResponse = myPageService.patchLogout()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import javax.inject.Inject
class MyPageRepositoryImpl @Inject constructor(
private val myPageDataSource: MyPageDataSource
) : MyPageRepository {
override suspend fun patchLogout(): Result<Unit> =
override suspend fun postLogout(): Result<Unit> =
runCatching {
myPageDataSource.patchLogout()
myPageDataSource.postLogout()
}
}
3 changes: 1 addition & 2 deletions data/src/main/java/com/terning/data/service/MyPageService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ import retrofit2.http.POST

interface MyPageService {
@POST("api/v1/auth/logout")
suspend fun patchLogout(): NonDataBaseResponse

suspend fun postLogout(): NonDataBaseResponse
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.terning.domain.repository

interface MyPageRepository {
suspend fun patchLogout() : Result<Unit>
suspend fun postLogout() : Result<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ class MyPageViewModel @Inject constructor(
fun logoutKakao() {
UserApiClient.instance.logout { error ->
if (error == null) {
patchLogout()
postLogout()
} else {
_state.value = _state.value.copy(isSuccess = UiState.Failure(error.toString()))
}
}
}

private fun patchLogout() {
private fun postLogout() {
viewModelScope.launch {
myPageRepository.patchLogout().onSuccess {
myPageRepository.postLogout().onSuccess {
tokenRepository.clearInfo()
_state.value = _state.value.copy(isSuccess = UiState.Success(true))
}.onFailure {
Expand Down

0 comments on commit 6a8c7bc

Please sign in to comment.