reports page implementation
This commit is contained in:
@@ -40,7 +40,11 @@ void main() async {
|
||||
/// The main application module.
|
||||
class AppModule extends Module {
|
||||
@override
|
||||
List<Module> get imports => <Module>[core_localization.LocalizationModule()];
|
||||
List<Module> get imports =>
|
||||
<Module>[
|
||||
core_localization.LocalizationModule(),
|
||||
staff_authentication.StaffAuthenticationModule(),
|
||||
];
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'package:staff_authentication/staff_authentication.dart';
|
||||
|
||||
/// A widget that listens to session state changes and handles global reactions.
|
||||
///
|
||||
@@ -40,7 +41,7 @@ class _SessionListenerState extends State<SessionListener> {
|
||||
debugPrint('[SessionListener] Initialized session listener');
|
||||
}
|
||||
|
||||
void _handleSessionChange(SessionState state) {
|
||||
Future<void> _handleSessionChange(SessionState state) async {
|
||||
if (!mounted) return;
|
||||
|
||||
switch (state.type) {
|
||||
@@ -65,6 +66,19 @@ class _SessionListenerState extends State<SessionListener> {
|
||||
_sessionExpiredDialogShown = false;
|
||||
debugPrint('[SessionListener] Authenticated: ${state.userId}');
|
||||
|
||||
if (StaffSessionStore.instance.session == null) {
|
||||
try {
|
||||
final AuthRepositoryInterface authRepo =
|
||||
Modular.get<AuthRepositoryInterface>();
|
||||
await authRepo.restoreSession();
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
_proceedToLogin();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Navigate to the main app
|
||||
Modular.to.toStaffHome();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user