Skip to content

Commit

Permalink
[FIX/#68] interceptor 원상복귀
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchbreeze committed Jan 10, 2024
1 parent 40b10f7 commit 1a8d531
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions data/src/main/java/com/going/data/interceptor/AuthInterceptor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ class AuthInterceptor @Inject constructor(

Timber.d("GET ACCESS TOKEN : ${dataStore.accessToken}")

// val authRequest = if (dataStore.accessToken.isNotBlank()) {
// originalRequest.newAuthBuilder().build()
// } else {
// originalRequest
// }
val authRequest = originalRequest.newAuthBuilder().build()
val authRequest = if (dataStore.accessToken.isNotBlank()) {
originalRequest.newAuthBuilder().build()
} else {
originalRequest
}

val response = chain.proceed(authRequest)

Expand Down Expand Up @@ -85,15 +84,7 @@ class AuthInterceptor @Inject constructor(
return response
}

// private fun Request.newAuthBuilder() =
// this.newBuilder().addHeader(AUTHORIZATION, "$BEARER ${dataStore.accessToken}")

private fun Request.newAuthBuilder() : Request.Builder {
return this.newBuilder().addHeader(
AUTHORIZATION,
"$BEARER eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1IiwiaWF0IjoxNzA0ODg5NjQyLCJleHAiOjE3MDU0OTQ0NDJ9.8UX1IhC78LdXw6YHF-EN9Mm8E2sKuhYnoBk5ePp3LfE"
)
}
private fun Request.newAuthBuilder() = this.newBuilder().addHeader(AUTHORIZATION, "$BEARER ${dataStore.accessToken}")

companion object {
private const val CODE_TOKEN_EXPIRED = 401
Expand Down

0 comments on commit 1a8d531

Please sign in to comment.