Add cookie with current school year
This commit is contained in:
parent
0aea843800
commit
bc60169383
1 changed files with 3 additions and 1 deletions
|
@ -2,6 +2,7 @@ package io.github.wulkanowy.api.interceptor
|
|||
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
import org.threeten.bp.LocalDate.now
|
||||
import java.net.CookieManager
|
||||
import java.net.HttpCookie
|
||||
import java.net.URI
|
||||
|
@ -18,7 +19,8 @@ class StudentAndParentInterceptor(
|
|||
arrayOf(
|
||||
arrayOf("idBiezacyDziennik", diaryId),
|
||||
arrayOf("idBiezacyUczen", studentId),
|
||||
arrayOf("idBiezacyDziennikPrzedszkole", 0)
|
||||
arrayOf("idBiezacyDziennikPrzedszkole", 0),
|
||||
arrayOf("biezacyRokSzkolny", if (now().monthValue < 9) now().year - 1 else now().year) // TODO: replace this with a year based on config
|
||||
).forEach { cookie ->
|
||||
arrayOf("opiekun", "uczen").forEach { module ->
|
||||
HttpCookie(cookie[0].toString(), cookie[1].toString()).let {
|
||||
|
|
Loading…
Reference in a new issue