feat: route agents to the profile screen instead of home upon authentication
This commit is contained in:
@@ -65,7 +65,10 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
|
||||
// Navigate on auth state changes
|
||||
ref.listen<AuthState>(authProvider, (previous, next) {
|
||||
if (next.status == AuthStatus.authenticated) {
|
||||
context.go('/home');
|
||||
// Agents land on /profile (defaults to "Edit Profile" tab —
|
||||
// their dashboard/home view). Users land on /home.
|
||||
final isAgent = next.user?.role == 'AGENT';
|
||||
context.go(isAgent ? '/profile' : '/home');
|
||||
}
|
||||
// Navigate to 2FA verification screen
|
||||
if (next.requiresTwoFactor && next.tempToken != null) {
|
||||
|
||||
@@ -95,10 +95,12 @@ class _Verify2faScreenState extends ConsumerState<Verify2faScreen> {
|
||||
final authState = ref.watch(authProvider);
|
||||
final isLoading = authState.status == AuthStatus.loading;
|
||||
|
||||
// Navigate to home when authentication succeeds, reset submit lock on error.
|
||||
// Navigate when authentication succeeds, reset submit lock on error.
|
||||
// Agents land on /profile (Edit Profile tab — their home/dashboard view).
|
||||
ref.listen<AuthState>(authProvider, (previous, next) {
|
||||
if (next.status == AuthStatus.authenticated) {
|
||||
context.go('/home');
|
||||
final isAgent = next.user?.role == 'AGENT';
|
||||
context.go(isAgent ? '/profile' : '/home');
|
||||
}
|
||||
if (next.status != AuthStatus.loading) {
|
||||
_isSubmitting = false;
|
||||
|
||||
Reference in New Issue
Block a user