reg
Deploy Iddaai Frontend / build-and-deploy (push) Successful in 3m57s

This commit is contained in:
2026-04-16 17:22:48 +03:00
parent fc7a1ba567
commit 1c1d87176e
+22 -3
View File
@@ -24,6 +24,8 @@ import { PasswordInput } from "@/components/ui/forms/password-input";
import { Skeleton } from "@/components/ui/feedback/skeleton"; import { Skeleton } from "@/components/ui/feedback/skeleton";
import { authService } from "@/lib/api/example/auth/service"; import { authService } from "@/lib/api/example/auth/service";
import { useState } from "react"; import { useState } from "react";
import { signIn } from "next-auth/react";
import { toaster } from "@/components/ui/feedback/toaster";
const schema = yup.object({ const schema = yup.object({
name: yup.string().required(), name: yup.string().required(),
@@ -53,9 +55,26 @@ function SignUpPage() {
firstName: formData.name, firstName: formData.name,
lastName: "", lastName: "",
}); });
router.replace("/signin");
} catch { const res = await signIn("credentials", {
// Error handled by api-service interceptor (toast + 422 display) redirect: false,
email: formData.email,
password: formData.password,
});
if (res?.error) {
throw new Error(res.error);
}
router.replace("/home");
} catch (error) {
if (error instanceof Error && error.message) {
toaster.error({
title: error.message,
type: "error",
});
}
// other errors are handled by api-service interceptor (toast + 422 display)
} finally { } finally {
setIsSubmitting(false); setIsSubmitting(false);
} }