Skip to content

Commit

Permalink
#86 chore : 임시 token 헤더 삽입 로직 삭제
Browse files Browse the repository at this point in the history
Co-authored-by: BENDENG1 <[email protected]>
Co-authored-by: yy0ung <[email protected]>
  • Loading branch information
3 people committed Nov 22, 2023
1 parent 48c0bc7 commit d5b0e58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,17 @@ import com.avengers.nibobnebob.data.model.response.MyInfoResponse
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.PUT

interface MyPageApi {
@GET("api/user/details")
suspend fun getMyInfo(
@Header("Authorization") token: String,
): Response<BaseResponse<MyInfoResponse>>
suspend fun getMyInfo(): Response<BaseResponse<MyInfoResponse>>

@GET("api/user")
suspend fun getMyDefaultInfo(
@Header("Authorization") token: String,
): Response<BaseResponse<MyDefaultInfoResponse>>
suspend fun getMyDefaultInfo(): Response<BaseResponse<MyDefaultInfoResponse>>

@PUT("api/user")
suspend fun editMyInfo(
@Header("Authorization") token: String,
@Body data: EditMyInfoRequest
): Response<Unit>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@ import kotlinx.coroutines.flow.flow
import javax.inject.Inject

class MyPageRepositoryImpl @Inject constructor(private val api: MyPageApi) : MyPageRepository {
private val token =
"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiaWQiOjIsImlhdCI6MjAxNjIzOTAyMn0.VMvtPcawKVzNyOV08lrArxUvM-XxowWIknsPFkjRTws"

override fun getMyInfo(): Flow<BaseState<BaseResponse<MyInfoResponse>>> = flow {
val result = runRemote { api.getMyInfo(token) }
val result = runRemote { api.getMyInfo() }
emit(result)

}

override fun getMyDefaultInfo(): Flow<BaseState<BaseResponse<MyDefaultInfoResponse>>> = flow {
val result = runRemote { api.getMyDefaultInfo(token) }
val result = runRemote { api.getMyDefaultInfo() }
emit(result)
}

override fun editMyInfo(data: EditMyInfoRequest): Flow<BaseState<Unit>> = flow {
val result = runRemote { api.editMyInfo(token, data) }
val result = runRemote { api.editMyInfo( data) }
emit(result)
}

Expand Down

0 comments on commit d5b0e58

Please sign in to comment.