Commit ebaa5d9b authored by Yoon, Daeki's avatar Yoon, Daeki 😅
Browse files

회원가입 화면 useState 버그 수정

parent 7d95fbba
import React, { FormEvent, useEffect, useState } from "react"; import React, { FormEvent, useEffect, useState } from "react";
import { Link, useNavigate } from "react-router-dom"; import { Link, Navigate } from "react-router-dom";
import { authApi } from "../apis"; import { authApi } from "../apis";
import { catchErrors } from "../helpers"; import { catchErrors } from "../helpers";
import { SpinnerIcon } from "../icons"; import { SpinnerIcon } from "../icons";
...@@ -17,7 +17,6 @@ export default function Signup() { ...@@ -17,7 +17,6 @@ export default function Signup() {
const [error, setError] = useState(""); const [error, setError] = useState("");
const [disabled, setDisabled] = useState(false); const [disabled, setDisabled] = useState(false);
const [success, setSuccess] = useState(false); const [success, setSuccess] = useState(false);
const navigate = useNavigate();
useEffect(() => { useEffect(() => {
setDisabled(!(user.name && user.email && user.password && user.password2)); setDisabled(!(user.name && user.email && user.password && user.password2));
...@@ -65,7 +64,7 @@ export default function Signup() { ...@@ -65,7 +64,7 @@ export default function Signup() {
if (success) { if (success) {
alert("회원가입 되었습니다"); alert("회원가입 되었습니다");
navigate("/login", { replace: true }); return <Navigate to={"/login"} replace />;
} }
return ( return (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment