Fix boton cerrar sesion, añadido rutas en router
This commit is contained in:
@@ -3,6 +3,9 @@ import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'package:energy_media/helpers/globals.dart';
|
||||
import 'package:energy_media/pages/videos/videos_layout.dart';
|
||||
import 'package:energy_media/pages/videos/premium_dashboard_page.dart';
|
||||
import 'package:energy_media/pages/videos/gestor_videos_page.dart';
|
||||
import 'package:energy_media/pages/videos/config_page.dart';
|
||||
import 'package:energy_media/pages/pages.dart';
|
||||
import 'package:energy_media/services/navigation_service.dart';
|
||||
|
||||
@@ -20,24 +23,13 @@ final GoRouter router = GoRouter(
|
||||
|
||||
//if user is logged in and in the login page
|
||||
if (loggedIn && isLoggingIn) {
|
||||
if (currentUser!.role.roleId == 14 || currentUser!.role.roleId == 13) {
|
||||
return '/book_page_main';
|
||||
} else {
|
||||
return '/';
|
||||
}
|
||||
return '/';
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
errorBuilder: (context, state) => const PageNotFoundPage(),
|
||||
routes: <RouteBase>[
|
||||
GoRoute(
|
||||
path: '/',
|
||||
name: 'root',
|
||||
builder: (BuildContext context, GoRouterState state) {
|
||||
return const VideosLayout();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
@@ -45,5 +37,37 @@ final GoRouter router = GoRouter(
|
||||
return const LoginPage();
|
||||
},
|
||||
),
|
||||
ShellRoute(
|
||||
builder: (context, state, child) {
|
||||
return VideosLayout(child: child);
|
||||
},
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
redirect: (context, state) => '/dashboard',
|
||||
),
|
||||
GoRoute(
|
||||
path: '/dashboard',
|
||||
name: 'dashboard',
|
||||
pageBuilder: (context, state) => NoTransitionPage(
|
||||
child: const PremiumDashboardPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/videos',
|
||||
name: 'videos',
|
||||
pageBuilder: (context, state) => NoTransitionPage(
|
||||
child: const GestorVideosPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/config',
|
||||
name: 'config',
|
||||
pageBuilder: (context, state) => NoTransitionPage(
|
||||
child: const ConfigPage(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user