번호 자동 부여 대응 및 API 공통 처리 보강
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../../features/approvals/history/presentation/pages/approval_history_page.dart';
|
||||
import '../../features/auth/application/auth_service.dart';
|
||||
import '../../features/approvals/request/presentation/pages/approval_request_page.dart';
|
||||
import '../../features/approvals/step/presentation/pages/approval_step_page.dart';
|
||||
import '../../features/approvals/template/presentation/pages/approval_template_page.dart';
|
||||
@@ -34,6 +36,18 @@ final _rootNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'root');
|
||||
final appRouter = GoRouter(
|
||||
navigatorKey: _rootNavigatorKey,
|
||||
initialLocation: loginRoutePath,
|
||||
redirect: (context, state) {
|
||||
final authService = GetIt.I<AuthService>();
|
||||
final loggedIn = authService.session != null;
|
||||
final loggingIn = state.uri.path == loginRoutePath;
|
||||
if (!loggedIn && !loggingIn) {
|
||||
return loginRoutePath;
|
||||
}
|
||||
if (loggedIn && loggingIn) {
|
||||
return dashboardRoutePath;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
routes: [
|
||||
GoRoute(path: '/', redirect: (_, __) => loginRoutePath),
|
||||
GoRoute(
|
||||
|
||||
Reference in New Issue
Block a user