Skip to content

Commit 997c788

Browse files
committed
fix(authentication): navigate to correct verification page based on context
- Add conditional navigation based on current route name - Use named routes for account linking and standard authentication - Pass email as a path parameter to verification page
1 parent 3fedb86 commit 997c788

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/authentication/view/request_code_page.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@ class _RequestCodeView extends StatelessWidget {
6868
// Navigate to the code verification page on success, passing the email.
6969
// The current route's parent will determine if this is for linking
7070
// or standard authentication.
71-
context.go(
72-
'${GoRouter.of(context).routerDelegate.currentConfiguration.last.matchedLocation}/${Routes.verifyCode}/${state.email!}',
73-
);
71+
final currentRouteName = GoRouter.of(context).routerDelegate.currentConfiguration.last.route.name;
72+
if (currentRouteName == Routes.accountLinkingRequestCodeName) {
73+
context.goNamed(Routes.accountLinkingVerifyCodeName, pathParameters: {'email': state.email!});
74+
} else {
75+
context.goNamed(Routes.verifyCodeName, pathParameters: {'email': state.email!});
76+
}
7477
}
7578
},
7679
// BuildWhen prevents unnecessary rebuilds if only listening

0 commit comments

Comments
 (0)