Skip to content

Commit

Permalink
[MOD] #339 runBlocking제거
Browse files Browse the repository at this point in the history
  • Loading branch information
sxunea committed Mar 27, 2024
1 parent 625d913 commit e9c245b
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import com.runnect.runnect.util.preference.AuthUtil.getNewToken
import com.runnect.runnect.util.preference.AuthUtil.saveToken
import com.runnect.runnect.util.preference.StatusType.LoginStatus
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import okhttp3.Interceptor
Expand Down Expand Up @@ -53,15 +51,14 @@ class AuthInterceptor @Inject constructor(
}
}

private fun Request.newAuthTokenBuilder() =
runBlocking(Dispatchers.IO) {
val accessToken = context.getAccessToken()
val refreshToken = context.getNewToken()
newBuilder().apply {
addHeader(ACCESS_TOKEN, accessToken)
addHeader(REFRESH_TOKEN, refreshToken)
}
private fun Request.newAuthTokenBuilder(): Request.Builder {
val accessToken = context.getAccessToken()
val refreshToken = context.getNewToken()
return newBuilder().apply {
addHeader(ACCESS_TOKEN, accessToken)
addHeader(REFRESH_TOKEN, refreshToken)
}
}


private fun handleTokenExpired(
Expand Down

0 comments on commit e9c245b

Please sign in to comment.