From 6a8c7bc64796ef14ef78d1a9a2629965705af67e Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 18 Jul 2024 03:46:23 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT/#106]=20=ED=95=A8=EC=88=98=EB=AA=85=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/data/datasource/MyPageDataSource.kt | 2 +- .../com/terning/data/datasourceimpl/MyPageDataSourceImpl.kt | 2 +- .../com/terning/data/repositoryimpl/MyPageRepositoryImpl.kt | 4 ++-- .../src/main/java/com/terning/data/service/MyPageService.kt | 3 +-- .../java/com/terning/domain/repository/MyPageRepository.kt | 2 +- .../main/java/com/terning/feature/mypage/MyPageViewModel.kt | 6 +++--- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/data/src/main/java/com/terning/data/datasource/MyPageDataSource.kt b/data/src/main/java/com/terning/data/datasource/MyPageDataSource.kt index c543a9ac5..aec35848d 100644 --- a/data/src/main/java/com/terning/data/datasource/MyPageDataSource.kt +++ b/data/src/main/java/com/terning/data/datasource/MyPageDataSource.kt @@ -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 } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/datasourceimpl/MyPageDataSourceImpl.kt b/data/src/main/java/com/terning/data/datasourceimpl/MyPageDataSourceImpl.kt index a635ce12f..97a3c5ae9 100644 --- a/data/src/main/java/com/terning/data/datasourceimpl/MyPageDataSourceImpl.kt +++ b/data/src/main/java/com/terning/data/datasourceimpl/MyPageDataSourceImpl.kt @@ -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() } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/repositoryimpl/MyPageRepositoryImpl.kt b/data/src/main/java/com/terning/data/repositoryimpl/MyPageRepositoryImpl.kt index 4b161b4f6..580294a1d 100644 --- a/data/src/main/java/com/terning/data/repositoryimpl/MyPageRepositoryImpl.kt +++ b/data/src/main/java/com/terning/data/repositoryimpl/MyPageRepositoryImpl.kt @@ -7,8 +7,8 @@ import javax.inject.Inject class MyPageRepositoryImpl @Inject constructor( private val myPageDataSource: MyPageDataSource ) : MyPageRepository { - override suspend fun patchLogout(): Result = + override suspend fun postLogout(): Result = runCatching { - myPageDataSource.patchLogout() + myPageDataSource.postLogout() } } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/service/MyPageService.kt b/data/src/main/java/com/terning/data/service/MyPageService.kt index 464814e07..9c73cd98c 100644 --- a/data/src/main/java/com/terning/data/service/MyPageService.kt +++ b/data/src/main/java/com/terning/data/service/MyPageService.kt @@ -5,6 +5,5 @@ import retrofit2.http.POST interface MyPageService { @POST("api/v1/auth/logout") - suspend fun patchLogout(): NonDataBaseResponse - + suspend fun postLogout(): NonDataBaseResponse } \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/repository/MyPageRepository.kt b/domain/src/main/java/com/terning/domain/repository/MyPageRepository.kt index c4cebf922..3e2ac65c7 100644 --- a/domain/src/main/java/com/terning/domain/repository/MyPageRepository.kt +++ b/domain/src/main/java/com/terning/domain/repository/MyPageRepository.kt @@ -1,5 +1,5 @@ package com.terning.domain.repository interface MyPageRepository { - suspend fun patchLogout() : Result + suspend fun postLogout() : Result } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/MyPageViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/MyPageViewModel.kt index 96b10be01..fdcbf8c50 100644 --- a/feature/src/main/java/com/terning/feature/mypage/MyPageViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/MyPageViewModel.kt @@ -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 {