sign up to login

This commit is contained in:
2025-02-09 01:12:22 +08:00
parent 90ec907cb3
commit d21f94b168

View File

@@ -3,7 +3,6 @@ import { IconMail, IconLock } from "@tabler/icons-react";
import { useState } from "react";
import { toast } from "react-toastify";
import http from "../http";
import { useNavigate } from "react-router-dom";
export default function SignupView({
onLogin,
@@ -21,8 +20,6 @@ export default function SignupView({
const [password, setPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState("");
const navigate = useNavigate();
const validatePassword = (password: string): boolean => {
const passwordComplexityRegex =
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{12,}$/;
@@ -78,8 +75,9 @@ export default function SignupView({
throw new Error("Failed to sign up");
}
toast.success("User signed up successfully");
navigate("/");
toast.success("Welcome to Ace Job, " + firstName + "!", {
onClose: onLogin,
});
} catch (error) {
toast.error((error as any).response?.data || "Error during signup");
}