Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix(app): In Login, run automatic login only the first time the page …
Browse files Browse the repository at this point in the history
…is loaded
  • Loading branch information
AndreaBrighi committed May 4, 2023
1 parent 75d351e commit bd147b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/src/main/kotlin/com/intelligentbackpack/app/view/Login.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -48,8 +49,10 @@ fun Login(
factory = LoginViewModel.Factory,
)
) {
loginViewModel.tryAutomaticLogin {
navController.navigate(MainNavigation.home)
LaunchedEffect(Unit) {
loginViewModel.tryAutomaticLogin {
navController.navigate(MainNavigation.home)
}
}
LoginPage(navController, loginViewModel::login)
}
Expand Down

0 comments on commit bd147b8

Please sign in to comment.