From 1c629508583e0323679253352fc19ee5ed6bd8ab Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 12 Jan 2024 09:55:10 +0900 Subject: [PATCH] =?UTF-8?q?[MOD/#73]=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../going/data/interceptor/AuthInterceptor.kt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/data/src/main/java/com/going/data/interceptor/AuthInterceptor.kt b/data/src/main/java/com/going/data/interceptor/AuthInterceptor.kt index 2597f571..5655dbad 100644 --- a/data/src/main/java/com/going/data/interceptor/AuthInterceptor.kt +++ b/data/src/main/java/com/going/data/interceptor/AuthInterceptor.kt @@ -23,13 +23,12 @@ class AuthInterceptor @Inject constructor( Timber.d("GET ACCESS TOKEN : ${dataStore.accessToken}") -// val authRequest = if (dataStore.accessToken.isNotBlank()) { -// originalRequest.newAuthBuilder().build() -// } else { -// originalRequest -// } + val authRequest = if (dataStore.accessToken.isNotBlank()) { + originalRequest.newAuthBuilder().build() + } else { + originalRequest + } - val authRequest = originalRequest.newAuthBuilder().build() val response = chain.proceed(authRequest) when (response.code) { @@ -85,12 +84,10 @@ class AuthInterceptor @Inject constructor( } return response } -// -// private fun Request.newAuthBuilder() = -// this.newBuilder().addHeader(AUTHORIZATION, "$BEARER ${dataStore.accessToken}") - private fun Request.newAuthBuilder() = - this.newBuilder().addHeader(AUTHORIZATION, "$BEARER eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI2IiwiaWF0IjoxNzA0ODk1NDE4LCJleHAiOjE3MDU1MDAyMTh9.FWPJhGl9amOs1Aog1snD2O1ayVm6lRYBJgHOndyWdMQ") + private fun Request.newAuthBuilder() = + this.newBuilder().addHeader(AUTHORIZATION, "$BEARER ${dataStore.accessToken}") + companion object { private const val CODE_TOKEN_EXPIRED = 401 private const val BEARER = "Bearer"