Skip to content

Commit

Permalink
refactor: googleLogin Response 수정 (#50)
Browse files Browse the repository at this point in the history
* refactor: googleLogin Response 수정

* chore: response naming 변경
  • Loading branch information
rhkrwngud445 authored Mar 11, 2024
1 parent e8e7de5 commit 000c969
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class DefaultTokenRepository @Inject constructor(
): Flow<Unit> = flow {
authService.googleLogin(AUTHORIZATION_FORMAT.format(idToken)).suspendMapSuccess {
val data = this.data
tokenPreferenceDataSource.updateAccessToken(data.accessToken)
tokenPreferenceDataSource.updateRefreshToken(data.refreshToken)
tokenPreferenceDataSource.updateAccessToken(data.tokenResponse.accessToken)
tokenPreferenceDataSource.updateRefreshToken(data.tokenResponse.refreshToken)
emit(Unit)
}.suspendOnFailure { onError(message()) }
}.flowOn(Dispatchers.IO)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.withpeace.withpeace.core.network.di.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class LoginResponse(
@SerialName("jwtTokenDto")
val tokenResponse: TokenResponse,
val role: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.withpeace.withpeace.core.network.di.service

import com.skydoves.sandwich.ApiResponse
import com.withpeace.withpeace.core.network.di.response.BaseResponse
import com.withpeace.withpeace.core.network.di.response.LoginResponse
import com.withpeace.withpeace.core.network.di.response.TokenResponse
import retrofit2.http.Header
import retrofit2.http.POST
Expand All @@ -12,7 +13,7 @@ interface AuthService {
suspend fun googleLogin(
@Header("Authorization")
idToken: String,
): ApiResponse<BaseResponse<TokenResponse>>
): ApiResponse<BaseResponse<LoginResponse>>

@POST("/api/v1/auth/refresh")
suspend fun refreshAccessToken(): ApiResponse<BaseResponse<TokenResponse>>
Expand Down

0 comments on commit 000c969

Please sign in to comment.