chore: fix routes not working when initially signing in

This commit is contained in:
Kingkor Roy Tirtho 2025-02-11 20:25:34 +06:00
parent 1c56617955
commit 4ea0523692

View File

@ -14,21 +14,6 @@ class AppRouter extends RootStackRouter {
AppRouter(this.ref) : super(navigatorKey: rootNavigatorKey);
@override
List<AutoRouteGuard> get guards => [
AutoRouteGuardCallback(
(resolver, router) async {
final auth = await ref.read(authenticationProvider.future);
if (auth == null && !KVStoreService.doneGettingStarted) {
resolver.redirect(const GettingStartedRoute());
} else {
resolver.next(true);
}
},
),
];
@override
List<AutoRoute> get routes => [
AutoRoute(
@ -40,6 +25,19 @@ class AppRouter extends RootStackRouter {
path: "home",
page: HomeRoute.page,
initial: true,
guards: [
AutoRouteGuardCallback(
(resolver, router) async {
final auth = await ref.read(authenticationProvider.future);
if (auth == null && !KVStoreService.doneGettingStarted) {
resolver.redirect(const GettingStartedRoute());
} else {
resolver.next(true);
}
},
),
],
),
AutoRoute(
path: "home/genres",