61 lines
1.9 KiB
Dart
61 lines
1.9 KiB
Dart
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:pweb/app/router/page_params.dart';
|
|
import 'package:pweb/app/router/pages.dart';
|
|
import 'package:pweb/app/router/payout_shell.dart';
|
|
import 'package:pweb/app/router/payout_routes.dart';
|
|
import 'package:pweb/pages/2fa/page.dart';
|
|
import 'package:pweb/pages/errors/not_found.dart';
|
|
import 'package:pweb/pages/login/page.dart';
|
|
import 'package:pweb/pages/signup/page.dart';
|
|
import 'package:pweb/pages/signup/confirmation/args.dart';
|
|
import 'package:pweb/pages/signup/confirmation/page.dart';
|
|
import 'package:pweb/pages/verification/page.dart';
|
|
|
|
|
|
GoRouter createRouter() => GoRouter(
|
|
debugLogDiagnostics: true,
|
|
routes: <RouteBase>[
|
|
GoRoute(
|
|
name: Pages.root.name,
|
|
path: routerPage(Pages.root),
|
|
builder: (_, __) => const LoginPage(),
|
|
),
|
|
GoRoute(
|
|
name: Pages.login.name,
|
|
path: routerPage(Pages.login),
|
|
builder: (_, __) => const LoginPage(),
|
|
),
|
|
GoRoute(
|
|
name: Pages.sfactor.name,
|
|
path: routerPage(Pages.sfactor),
|
|
builder: (context, _) => TwoFactorCodePage(
|
|
onVerificationSuccess: () => context.goNamed(PayoutRoutes.dashboard),
|
|
),
|
|
),
|
|
GoRoute(
|
|
name: Pages.signup.name,
|
|
path: routerPage(Pages.signup),
|
|
builder: (_, __) => const SignUpPage(),
|
|
),
|
|
GoRoute(
|
|
name: Pages.signupConfirm.name,
|
|
path: routerPage(Pages.signupConfirm),
|
|
builder: (_, state) => SignUpConfirmationPage(
|
|
email: state.extra is SignupConfirmationArgs
|
|
? (state.extra as SignupConfirmationArgs).email
|
|
: null,
|
|
),
|
|
),
|
|
GoRoute(
|
|
name: Pages.verify.name,
|
|
path: '${routerPage(Pages.verify)}${routerAddParam(PageParams.token)}',
|
|
builder: (_, state) => AccountVerificationPage(
|
|
token: state.pathParameters[PageParams.token.name]!,
|
|
),
|
|
),
|
|
payoutShellRoute(),
|
|
],
|
|
errorBuilder: (_, __) => const NotFoundPage(),
|
|
);
|