Skip to content

Commit

Permalink
feat: Pass 본인 인증 예외 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
DaeHee99 committed Jan 27, 2025
1 parent 75868c4 commit 3c4d0d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 5 additions & 7 deletions src/components/PassCheck/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface Props {
function PassCheck({ completeHandler }: Props) {
const passResult = localStorage.getItem("passResult");
const impUid = localStorage.getItem("impUid");
const [showModal, setShowModal] = useState(impUid ? true : false);
const [showModal, setShowModal] = useState(passResult ? true : false);
const [message, setMessage] = useState("");

const openPopup = useCallback(() => {
Expand All @@ -26,7 +26,7 @@ function PassCheck({ completeHandler }: Props) {
}, []);

useEffect(() => {
if (!passResult || !impUid) return;
if (!passResult) return;

if (passResult === "200") {
setMessage("본인 인증에 성공하였습니다.");
Expand All @@ -44,11 +44,9 @@ function PassCheck({ completeHandler }: Props) {

useEffect(() => {
if (showModal) return;
if (passResult === "200") {
completeHandler(impUid);
localStorage.removeItem("passResult");
localStorage.removeItem("impUid");
}
if (passResult === "200") completeHandler(impUid);
localStorage.removeItem("passResult");
localStorage.removeItem("impUid");
}, [showModal]);

return (
Expand Down
8 changes: 5 additions & 3 deletions src/pages/SignupPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ function SignupPage() {
}, [step]);

useEffect(() => {
if (!localStorage.getItem("isPassWaiting")) setLoading(false);
if (!paramImpUid || !paramStatusCode) setLoading(false);
if (!localStorage.getItem("isPassWaiting")) {
setLoading(false);
navigation("/signup", { replace: true });
} else if (!paramStatusCode) setLoading(false);
else {
setStep(1);
localStorage.setItem("impUid", paramImpUid);
localStorage.setItem("impUid", paramImpUid || "");
localStorage.setItem("passResult", paramStatusCode);
localStorage.removeItem("isPassWaiting");
navigation("/signup", { replace: true });
Expand Down

0 comments on commit 3c4d0d9

Please sign in to comment.