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"