Try to fetch cookies from both student and message module

This commit is contained in:
Mikołaj Pich 2024-01-03 02:25:56 +01:00
parent ce4695a7a1
commit 40d7e85d75

View file

@ -75,9 +75,13 @@ internal class AutoLoginInterceptor(
return try {
runBlocking {
notLoggedInCallback()
val messagesRes = runCatching { fetchMessagesCookies() }
.onFailure { logger.error("Error in messages cookies fetch", it) }
val studentRes = runCatching { fetchStudentCookies() }
.onFailure { logger.error("Error in student cookies fetch", it) }
when {
"wiadomosciplus" in uri.host -> fetchMessagesCookies()
"uczen" in uri.host -> fetchStudentCookies()
"wiadomosciplus" in uri.host -> messagesRes.getOrThrow()
"uczen" in uri.host -> studentRes.getOrThrow()
}
}
chain.proceed(chain.request().newBuilder().build())