v1 release
This commit is contained in:
commit
cb24b68069
116 changed files with 4913 additions and 0 deletions
18
lib/presentation/routes/account_guard.dart
Normal file
18
lib/presentation/routes/account_guard.dart
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import "package:auto_route/auto_route.dart";
|
||||
import "package:flash_mail/data/providers/providers.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
|
||||
class AccountGuard extends AutoRouteGuard {
|
||||
final WidgetRef ref;
|
||||
|
||||
AccountGuard(this.ref);
|
||||
|
||||
@override
|
||||
void onNavigation(NavigationResolver resolver, StackRouter router) {
|
||||
if (!ref.read(accountProvider).isAuthenticated()) {
|
||||
router.replaceNamed("/");
|
||||
} else {
|
||||
resolver.next(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue