Refactor login flow to return redirect URL instead of direct navigation
All checks were successful
Build And Push Image / docker (push) Successful in 2m43s
All checks were successful
Build And Push Image / docker (push) Successful in 2m43s
Move navigation responsibility from useAuth composable to login page component for better separation of concerns and component control.
This commit is contained in:
@@ -185,10 +185,13 @@ const handleLogin = async () => {
|
||||
rememberMe: credentials.value.rememberMe
|
||||
});
|
||||
|
||||
if (!result.success) {
|
||||
if (result.success) {
|
||||
// Handle redirect from the component
|
||||
console.log('🔄 Login successful, redirecting to:', result.redirectTo);
|
||||
await navigateTo(result.redirectTo || '/dashboard');
|
||||
} else {
|
||||
loginError.value = result.error || 'Login failed. Please check your credentials and try again.';
|
||||
}
|
||||
// If successful, the login method will handle the redirect
|
||||
} catch (error: any) {
|
||||
console.error('Login error:', error);
|
||||
loginError.value = authError.value || 'Login failed. Please check your credentials and try again.';
|
||||
|
||||
Reference in New Issue
Block a user