one more try to fix nosuchelement exception
This commit is contained in:
features
auth
client
src
commonMain
kotlin
dev
inmo
postssystem
features
auth
client
jsMain
kotlin
dev
inmo
postssystem
features
auth
client
common
src
commonMain
kotlin
dev
inmo
postssystem
features
auth
common
common
client
src
commonMain
kotlin
dev
inmo
postssystem
features
common
common
ui
roles
common
src
commonMain
kotlin
dev
inmo
postssystem
features
roles
common
manager
common
src
commonMain
kotlin
dev
inmo
postssystem
features
roles
manager
common
server
src
jvmMain
kotlin
dev
inmo
postssystem
features
roles
gradle
targets/telegram/loader/server/src/jvmMain/kotlin/dev/inmo/postssystem/targets/telegram/loader/server
@ -10,7 +10,6 @@ import dev.inmo.micro_utils.common.either
|
||||
import dev.inmo.micro_utils.repos.*
|
||||
import dev.inmo.postssystem.features.auth.client.createAuthorizedFeaturesDIModule
|
||||
import dev.inmo.postssystem.features.auth.client.ui.AuthUIError.AuthIncorrect
|
||||
import dev.inmo.postssystem.features.auth.client.ui.AuthUIError.ServerUnavailable
|
||||
import dev.inmo.postssystem.features.common.common.DBDropper
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
@ -85,7 +84,7 @@ data class DefaultAuthSettings(
|
||||
currentModule ?.let { koin.loadModules(listOf(currentModule)) }
|
||||
}
|
||||
return when {
|
||||
!serverAvailable -> ServerUnavailable
|
||||
!serverAvailable -> AuthUIError.ServerUnavailable
|
||||
!authCorrect -> AuthIncorrect
|
||||
else -> {
|
||||
_authorizedDIModule.value = newModule
|
||||
|
@ -1,12 +1,8 @@
|
||||
package dev.inmo.postssystem.features.auth.client.ui
|
||||
|
||||
import dev.inmo.postssystem.features.common.common.ui.fsm.UIFSMState
|
||||
import dev.inmo.postssystem.features.common.common.ui.fsm.UIFSMStateSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class AuthUIFSMState(
|
||||
@Serializable(UIFSMStateSerializer::class)
|
||||
override val from: UIFSMState?,
|
||||
override val context: String = "main"
|
||||
) : UIFSMState
|
||||
|
@ -3,21 +3,21 @@ package dev.inmo.postssystem.features.auth.client.ui
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
sealed class AuthUIError {
|
||||
sealed interface AuthUIError {
|
||||
@Serializable
|
||||
object ServerUnavailable : AuthUIError()
|
||||
object ServerUnavailable : AuthUIError
|
||||
@Serializable
|
||||
object AuthIncorrect : AuthUIError()
|
||||
object AuthIncorrect : AuthUIError
|
||||
}
|
||||
|
||||
@Serializable
|
||||
sealed class AuthUIState {
|
||||
sealed interface AuthUIState {
|
||||
@Serializable
|
||||
data class Init(val showError: AuthUIError? = null) : AuthUIState()
|
||||
data class Init(val showError: AuthUIError? = null) : AuthUIState
|
||||
@Serializable
|
||||
object Loading : AuthUIState()
|
||||
object Loading : AuthUIState
|
||||
@Serializable
|
||||
object Authorized : AuthUIState()
|
||||
object Authorized : AuthUIState
|
||||
|
||||
companion object {
|
||||
val DefaultInit = Init()
|
||||
|
@ -10,7 +10,6 @@ import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
||||
import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
|
||||
import dev.inmo.micro_utils.fsm.common.StatesMachine
|
||||
import dev.inmo.postssystem.features.auth.client.ui.AuthUIError.AuthIncorrect
|
||||
import dev.inmo.postssystem.features.auth.client.ui.AuthUIError.ServerUnavailable
|
||||
import dev.inmo.postssystem.features.common.common.*
|
||||
import dev.inmo.postssystem.features.common.common.ui.JSView
|
||||
import dev.inmo.postssystem.features.common.common.ui.fsm.*
|
||||
@ -98,7 +97,7 @@ class AuthView(
|
||||
disabled.value = false
|
||||
|
||||
errorText.value = when (it.showError) {
|
||||
ServerUnavailable -> "Server unavailable"
|
||||
AuthUIError.ServerUnavailable -> "Server unavailable"
|
||||
AuthIncorrect -> {
|
||||
passwordState.value = ""
|
||||
"Username or password is incorrect"
|
||||
|
Reference in New Issue
Block a user