Refactor login flow to return redirect URL instead of direct navigation
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:
2025-08-07 14:27:08 +02:00
parent af4fae6378
commit 789ecd7eab
2 changed files with 16 additions and 10 deletions

View File

@@ -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.';