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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user