fix: restore current contest and problem

This commit is contained in:
Johannes Frohnmeyer 2024-05-12 14:53:51 +02:00
parent d12d9cb3f0
commit c73c5ce4c8
Signed by: Johannes
GPG Key ID: E76429612C2929F4

View File

@ -138,9 +138,19 @@ object SDom {
val result = client.get("${SDCredentials.url}contests/${currentContest!!.id}/problems") val result = client.get("${SDCredentials.url}contests/${currentContest!!.id}/problems")
if (result.status.isSuccess()) { if (result.status.isSuccess()) {
problems = result.body<List<Problem>>() problems = result.body<List<Problem>>()
if (!problems.contains(currentProblem)) {
currentProblem = null
}
} }
} }
val loggedIn: Boolean val loggedIn: Boolean
get() = SDCredentials.credentials.first != null && SDCredentials.credentials.second != null get() = SDCredentials.credentials.first != null && SDCredentials.credentials.second != null
init {
if (loggedIn) {
loginListeners.forEach { ApplicationManager.getApplication().invokeLater(it) }
}
}
} }