Sempurnakan auth flow: AuthGate route ke LoginScreen saat sessionExpired, _ensureSessionAndAuth bedakan auth mati vs network blip, refresh() stop query saat auth mati, login() reset sessionExpired + muat data langsung

This commit is contained in:
Onie
2026-10-18 15:46:46 +07:00
parent 9e6b610549
commit bcea28fcc4
2 changed files with 27 additions and 7 deletions

View File

@@ -201,10 +201,11 @@ class AuthGate extends StatelessWidget {
),
);
}
return Selector<AppState, bool>(
selector: (context, state) => state.isLoggedIn,
builder: (context, loggedIn, child) {
if (loggedIn) {
return Selector<AppState, ({bool loggedIn, bool expired})>(
selector: (context, state) =>
(loggedIn: state.isLoggedIn, expired: state.sessionExpired),
builder: (context, auth, child) {
if (auth.loggedIn && !auth.expired) {
return const HomePage();
}
return const LoginScreen();