summaryrefslogtreecommitdiff
path: root/src/components/header/authdialog/RegisterForm.tsx
diff options
context:
space:
mode:
authorl3wdfut4pwr <l3wdfut4pwr@gmail.com>2026-04-09 15:48:36 +0300
committerl3wdfut4pwr <l3wdfut4pwr@gmail.com>2026-04-09 15:48:36 +0300
commit77ae39e8347ff2418d66424950e8b226900c6b62 (patch)
treecb472ac7b59ce1889c5bd554a5ff3a7e36debb1e /src/components/header/authdialog/RegisterForm.tsx
parentd3bceed42caca6ac8c39ebe0c929f7d3c13d2bfa (diff)
add settings auth redirect
Diffstat (limited to 'src/components/header/authdialog/RegisterForm.tsx')
-rw-r--r--src/components/header/authdialog/RegisterForm.tsx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/components/header/authdialog/RegisterForm.tsx b/src/components/header/authdialog/RegisterForm.tsx
index 0370671..ef22433 100644
--- a/src/components/header/authdialog/RegisterForm.tsx
+++ b/src/components/header/authdialog/RegisterForm.tsx
@@ -6,10 +6,11 @@ import { InputField } from '@/components/ui/inputfield';
import { validate, registerUser } from './register';
import { useAuthContext } from '@/lib/contexts/Auth.context';
import Image from 'next/image';
-
-export default function RegisterForm() {
+import { useRouter } from 'next/navigation';
+export default function RegisterForm({ redirectTo }: { redirectTo?: string }) {
const [errors, setErrors] = useState<any>({});
const [loading, setLoading] = useState(false);
+ const router = useRouter();
const { setUser } = useAuthContext();
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
@@ -42,6 +43,7 @@ export default function RegisterForm() {
setErrors(error);
} else if (data) {
setUser(data);
+ if (redirectTo) router.push(redirectTo);
}
setLoading(false);
};