Currently, when an unauthenticated user attempts to access a protected route, they are redirected to the login page. However, after successful authentication, the user is always taken to the default dashboard page instead of their originally requested URL. This creates a poor user experience as users need to manually navigate back to their intended destination.
Current Behavior
User attempts to access /protected-route
System redirects to /login
User successfully logs in
System redirects to /dashboard (default landing page)
Proposed Solution
Implement a redirect mechanism that:
Captures the original requested URL before redirecting to login
Stores this URL in session storage or URL parameter
Redirects the user to their intended destination after successful authentication
Remember redirect location after login
Problem Description
Currently, when an unauthenticated user attempts to access a protected route, they are redirected to the login page. However, after successful authentication, the user is always taken to the default dashboard page instead of their originally requested URL. This creates a poor user experience as users need to manually navigate back to their intended destination.
Current Behavior
/protected-route
/login
/dashboard
(default landing page)Proposed Solution
Implement a redirect mechanism that: