Samples
-
+ ('signin');
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
@@ -26,6 +28,8 @@ export function AuthForm() {
});
if (response.error) {
setError(response.error.message || 'Authentifizierung fehlgeschlagen');
+ } else {
+ router.push('/');
}
} else {
if (password !== confirmPassword) {
@@ -40,7 +44,10 @@ export function AuthForm() {
});
if (response.error) {
setError(response.error.message || 'Registrierung fehlgeschlagen');
+ } else {
+ router.push('/');
}
+
}
} catch (err: any) {
setError(err.message || 'Ein Fehler ist aufgetreten');
@@ -50,7 +57,7 @@ export function AuthForm() {
};
return (
-
{entries.map((entry, index) => (
{/* Entry number and filename */}
- {index + 1}. {`Sample ${index + 1}`}
+ {`Sample ${index + 1}`}
diff --git a/src/components/AuthForm.tsx b/src/components/AuthForm.tsx
index f5538e9..f8d4e2d 100644
--- a/src/components/AuthForm.tsx
+++ b/src/components/AuthForm.tsx
@@ -2,10 +2,12 @@
import { useState } from 'react';
import { authClient } from '@/lib/auth-client';
+import { useRouter } from 'next/navigation';
type AuthMode = 'signin' | 'signup';
export function AuthForm() {
+ const router = useRouter();
const [mode, setMode] = useState
+
{/* Card */}
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index f4e3339..d1a43e5 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -3,14 +3,17 @@
import { authClient } from '@/lib/auth-client';
import Link from 'next/link';
import { useState } from 'react';
+import { useRouter } from 'next/navigation';
export function Header() {
+ const router = useRouter();
const { data: session, isPending: loading } = authClient.useSession();
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const handleSignOut = async () => {
try {
await authClient.signOut({});
+ router.push('/');
} catch (error) {
console.error('Sign out failed:', error);
}