From 77ae39e8347ff2418d66424950e8b226900c6b62 Mon Sep 17 00:00:00 2001
From: l3wdfut4pwr <l3wdfut4pwr@gmail.com>
Date: Thu, 9 Apr 2026 15:48:36 +0300
Subject: add settings auth redirect

---
 src/components/header/authdialog/LoginForm.tsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'src/components/header/authdialog/LoginForm.tsx')

diff --git a/src/components/header/authdialog/LoginForm.tsx b/src/components/header/authdialog/LoginForm.tsx
index c6cdbcd..913ca66 100644
--- a/src/components/header/authdialog/LoginForm.tsx
+++ b/src/components/header/authdialog/LoginForm.tsx
@@ -4,13 +4,13 @@ import { Button } from '@/components/ui/button';
 import GoogleIcon from '../../../../public/icons/google.svg';
 import { InputField } from '@/components/ui/inputfield';
 import { useAuthContext } from '@/lib/contexts/Auth.context';
-
-export default function LoginForm() {
+import { useRouter } from 'next/navigation';
+export default function LoginForm({ redirectTo }: { redirectTo?: string }) {
     const API_URL = process.env.NEXT_PUBLIC_API_URL;
     const [errors, setErrors] = useState<any>({});
     const [loading, setLoading] = useState(false);
     const { setUser } = useAuthContext();
-
+    const router = useRouter();
     const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
         e.preventDefault();
         setLoading(true);
@@ -55,6 +55,7 @@ export default function LoginForm() {
                 if (!meRes.ok) throw new Error('Failed to fetch user');
                 const meData = await meRes.json();
                 setUser(meData);
+                if (redirectTo) router.push(redirectTo);
             }
         } catch (err) {
             setErrors({ general: 'Ошибка при авторизации' });
-- 
cgit v1.3-3-g829e

