강의

멘토링

커뮤니티

Inflearn Community Q&A

p425104751's profile image
p425104751

asked

Node and React series that you can learn by following - Basic lecture

Node React Basics Lecture #31 Membership Registration Page

회원가입 페이지 FAIL TO SIGN UP

Written on

·

448

0

회원가입 페이지 강의 들으면서 다 똑같이 코드 작성했는데 왜 fail to sign up이 뜰까요
fail to sign up이 뜨긴하는데 몽고db가서 보면 또 입력한 정보가 들어와 있습니다

  const onSubmitHandler = (e) => {
        e.preventDefault();

        if(password !== ConfirmPassword) {
            return alert('비밀번호와 비밀번호 확인은 같아야 합니다.')
        }

        let body = {
            email: Email,
            name: Name,
            password: password,
        }

        dispatch(registerUser(body))
        .then((response) => {
            if(response.payload.registerSuccess) {
                navigate('/login')
            } else {
                alert('Failed to sign up')
            }
        })
    }

그전에 혹시 서버쪽 코드가 문제가 있나 싶어 post에서 해봤을때도 정상인데 dispatch쪽에서 에러가 나는걸까요
 
nodejsreact

Answer 2

0

해결하셨겠지만 alert에서 response 받은 값을 콘솔로 확인해서 왜 false로 왔는지 확인해보세용

0

server 폴더에 있는 index.js에서 register 라우터를 작성할 때 return해 주는 json 값을 success로 줬어요~~ dispatch 이후 조건문을 if(response.payload.success) 으로 수정해도 오류가 나실까요?

p425104751's profile image
p425104751

asked

Ask a question