Skip to content

Commit

Permalink
refactor: isAccessTokenInvalid로 메서드명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
tmdgh1592 committed Nov 8, 2023
1 parent d17af73 commit fe4b862
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class AuthInterceptor(private val context: Context) : Interceptor {
val tokenAddedRequest = chain.request().putAccessToken(token?.accessToken)

val response = chain.proceed(tokenAddedRequest)
if (response.isAccessTokenExpired()) {
if (response.isAccessTokenInvalid()) {
navigateToLogin()
}
return response
}

private fun Response.isAccessTokenExpired(): Boolean = (code == 401)
private fun Response.isAccessTokenInvalid(): Boolean = (code == 401)

private fun Request.putAccessToken(token: String?): Request =
putHeader(ACCESS_TOKEN_HEADER, ACCESS_TOKEN_FORMAT.format(token))
Expand Down

0 comments on commit fe4b862

Please sign in to comment.