Skip to content

Commit

Permalink
[Hotfix] 401 else 처리 (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
HI-JIN2 authored Apr 6, 2024
1 parent aa618c5 commit ceafa87
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,27 @@ class TokenInterceptor @Inject constructor(
refreshTokenResponse.close()
val newRequest = originalRequest.newAuthBuilder().build()
return chain.proceed(newRequest)
} else {
/*
refreshTokenResponse : Response{protocol=http/1.1, code=401, message=, url=https://prod.eat-ssu.shop/oauths/reissue/token}
μœ„ μƒν™©μ—μ„œλ„ λ‘œκ·Έμ•„μ›ƒ
**λ¦¬ν”„λ ˆμ‰¬λ„ μƒν•œ μƒνƒœ
*/
runBlocking { logoutUseCase() }
Timber.e("μž¬λ°œκΈ‰μ—μ„œμ˜ 401")

Handler(Looper.getMainLooper()).post {
val context = App.appContext
Toast.makeText(context, "토큰이 λ§Œλ£Œλ˜μ–΄ λ‘œκ·Έμ•„μ›ƒ λ©λ‹ˆλ‹€.", Toast.LENGTH_SHORT).show()
val intent = Intent(context, LoginActivity::class.java) // 둜그인 ν™”λ©΄μœΌλ‘œ 이동
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
context.startActivity(intent)
}
}

} catch (e: Exception) {
runBlocking { logoutUseCase() }
Timber.tag(TAG).d("μž¬λ°œκΈ‰ μ‹€νŒ¨ " + e)
Timber.e("μž¬λ°œκΈ‰ μ‹€νŒ¨ $e")

Handler(Looper.getMainLooper()).post {
val context = App.appContext
Expand Down

0 comments on commit ceafa87

Please sign in to comment.