refactor: unify app navigation to default to HomeScreen and remove role-based routing redirection

This commit is contained in:
pradeepkumar
2026-05-06 14:59:38 +05:30
parent 6e77dc9d27
commit 019df719fc
4 changed files with 11 additions and 27 deletions

View File

@@ -95,12 +95,10 @@ class _Verify2faScreenState extends ConsumerState<Verify2faScreen> {
final authState = ref.watch(authProvider);
final isLoading = authState.status == AuthStatus.loading;
// Navigate when authentication succeeds, reset submit lock on error.
// Agents land on /profile (Edit Profile tab — their home/dashboard view).
// Navigate to home when authentication succeeds, reset submit lock on error.
ref.listen<AuthState>(authProvider, (previous, next) {
if (next.status == AuthStatus.authenticated) {
final isAgent = next.user?.role == 'AGENT';
context.go(isAgent ? '/profile' : '/home');
context.go('/home');
}
if (next.status != AuthStatus.loading) {
_isSubmitting = false;