feature/payment #77

Closed
manish.zure wants to merge 25 commits from feature/payment into main
Showing only changes of commit 3ad3515d8d - Show all commits

View File

@ -28,32 +28,15 @@ import 'package:marco/view/tenant/tenant_create_screen.dart';
class AuthMiddleware extends GetMiddleware {
@override
RouteSettings? redirect(String? route) {
// Public routes that don't require authentication
const publicRoutes = [
'/auth/login-option',
'/auth/login',
'/subscription',
'/payment',
'/select-tenant',
'/create-tenant',
];
// Allow any route that starts with these public routes
if (route != null &&
publicRoutes.any((public) => route.startsWith(public))) {
return null;
}
// Block others if not logged in
if (!AuthService.isLoggedIn) {
if (route != '/auth/login-option') {
return const RouteSettings(name: '/auth/login-option');
}
// Ensure tenant is selected after login
if (!TenantService.isTenantSelected) {
} else if (!TenantService.isTenantSelected) {
if (route != '/select-tenant') {
return const RouteSettings(name: '/select-tenant');
}
}
return null;
}
}
@ -79,10 +62,10 @@ getPageRoute() {
name: '/dashboard/attendance',
page: () => AttendanceScreen(),
middlewares: [AuthMiddleware()]),
// GetPage(
// name: '/dashboard',
// page: () => DashboardScreen(),
// middlewares: [AuthMiddleware()]),
GetPage(
name: '/dashboard',
page: () => DashboardScreen(),
middlewares: [AuthMiddleware()]),
GetPage(
name: '/dashboard/employees',
page: () => EmployeesScreen(),