Start writing the web app
All checks were successful
ci/woodpecker/push/build Pipeline was successful

Signed-off-by: Nikolai Rodionov <allanger@posteo.com>
This commit was merged in pull request #5.
This commit is contained in:
2026-05-19 13:37:41 +02:00
parent 0c5b657a2f
commit 09df205fdb
76 changed files with 1961 additions and 117 deletions

View File

@@ -0,0 +1,30 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:softplayer_web/core/tokens/application/tokens_application.dart';
import 'package:softplayer_web/features/authorization/application/authorization_application.dart';
import 'package:softplayer_web/features/authorization/presentation/authorization_page.dart';
import 'package:softplayer_web/features/dashboard/presentation/dashboard_page.dart';
final goRouterProvider = Provider<GoRouter>((ref) {
final authState = ref.watch(authorizationControllerProvider);
final _tokenCtrl = ref.watch(tokensControllerProvider);
// If not authorized, redirect to the auth page, otherwise dashboard
return GoRouter(
initialLocation: '/',
redirect: (context, state) {
final isAuthorized = authState.requireValue.isAuthorized;
if (!isAuthorized) {
return "/auth";
}
return "/";
},
routes: [
GoRoute(path: '/', builder: (context, state) => const DashboardPage()),
GoRoute(
path: '/auth',
builder: (context, state) => const AuthorizationPage(),
),
],
);
});