Performed first authentication
This commit is contained in:
@ -1,13 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:moneymgr_mobile/providers/auth_state.dart';
|
||||
import 'package:moneymgr_mobile/routes/login/login_screen.dart';
|
||||
import 'package:moneymgr_mobile/routes/login/manual_auth_screen.dart';
|
||||
import 'package:moneymgr_mobile/routes/settings/settings_screen.dart';
|
||||
import 'package:moneymgr_mobile/services/auth_state.dart';
|
||||
import 'package:moneymgr_mobile/services/router/routes_list.dart';
|
||||
import 'package:moneymgr_mobile/widgets/scaffold_with_navigation.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'router.g.dart';
|
||||
|
||||
/// The router config for the app.
|
||||
@ -94,7 +95,8 @@ GoRouter router(Ref ref) {
|
||||
|
||||
// Check if the current path is allowed for the current auth state. If not,
|
||||
// redirect to the redirect target of the current auth state.
|
||||
if (authState.allowedPaths?.contains(state.fullPath) == false) {
|
||||
if (authState.allowedPaths?.contains(state.fullPath) == false ||
|
||||
authState.forbiddenPaths?.contains(state.fullPath) == true) {
|
||||
return authState.redirectPath;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user