main.dart builder already wraps unauthenticated routes in AuthLayout. Wrapping again in handlers caused double login screen on all viewports. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
1.3 KiB
Dart
37 lines
1.3 KiB
Dart
import 'package:prosapp_web_app/providers/auth_provider.dart';
|
|
import 'package:prosapp_web_app/ui/views/dashboard_view.dart';
|
|
import 'package:prosapp_web_app/ui/views/login_view.dart';
|
|
import 'package:prosapp_web_app/ui/views/phone_login_view.dart';
|
|
import 'package:prosapp_web_app/ui/views/register_view.dart';
|
|
import 'package:fluro/fluro.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class AdminHandlers {
|
|
static Handler phone = Handler(handlerFunc: (context, params) {
|
|
final authProvider = Provider.of<AuthProvider>(context!);
|
|
if (authProvider.authStatus == AuthStatus.notAuthenticated) {
|
|
return const PhoneLoginView();
|
|
} else {
|
|
return const DashboardView();
|
|
}
|
|
});
|
|
|
|
static Handler login = Handler(handlerFunc: (context, params) {
|
|
final authProvider = Provider.of<AuthProvider>(context!);
|
|
if (authProvider.authStatus == AuthStatus.notAuthenticated) {
|
|
return const LoginView();
|
|
} else {
|
|
return const DashboardView();
|
|
}
|
|
});
|
|
|
|
static Handler register = Handler(handlerFunc: (context, params) {
|
|
final authProvider = Provider.of<AuthProvider>(context!);
|
|
if (authProvider.authStatus == AuthStatus.notAuthenticated) {
|
|
return const RegisterView();
|
|
} else {
|
|
return const DashboardView();
|
|
}
|
|
});
|
|
}
|