Auth: load auth on app start and fix storage when token is null to prevent intermittent logged-out state

This commit is contained in:
2025-10-08 23:11:08 +02:00
parent 38301efccb
commit e81abae275
2 changed files with 18 additions and 6 deletions

View File

@@ -174,8 +174,14 @@ fun KlottrAppShell(
val currentLoc = locService.location.collectAsState(initial = null)
val scope = rememberCoroutineScope()
// Säkerställ att auth återställs från plattforms-lagring vid uppstart
LaunchedEffect(Unit) {
app.klottr.util.AuthShared.loadFromStorage()
}
// Inloggning
val loggedIn by AuthShared.loggedIn.collectAsState(initial = false)
val loggedIn by AuthShared.loggedIn.collectAsState(initial = app.klottr.util.AuthShared.loggedIn.value)
// Initiera SQLDelight-databasen med hjälp av DatabaseFactory.
val db = remember {