LoginViewModel

ViewModel that manages login network requests and UI state.

Constructors

Link copied to clipboard
constructor(application: Application)

Properties

Link copied to clipboard
val errorMessage: StateFlow<String?>

Emits the latest user-visible error message, if any.

Link copied to clipboard
val isLoading: StateFlow<Boolean>

Emits whether a login attempt is currently in progress.

Link copied to clipboard
val loginState: StateFlow<LoginState>

Emits high-level login state transitions for UI/navigation.

Functions

Link copied to clipboard
open fun addCloseable(closeable: AutoCloseable)
fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard

Resets transient login state after handling success/error in UI.

Link copied to clipboard
open fun <T : Application> getApplication(): T
Link copied to clipboard
Link copied to clipboard
fun performLogin(username: String, password: String)

Attempts login using backend credentials API and stores auth tokens on success.