강의

멘토링

커뮤니티

Inflearn Community Q&A

yongje8120072's profile image
yongje8120072

asked

[Renewal] Creating a NodeBird SNS with React

Troubleshooting CORS Issues

403error가 발생합니다.

Written on

·

396

0

안녕하세요 제로초님.

회원가입 페이지에서 가입하기를 누르면 아래와 같이 403에러가 발생합니다.

back/routes/user.js

        if(exUser){
            console.log(`exUser! ${JSON.stringify(exUser)}`)
            return res.status(403).send('이미 사용중인 아이디 압니다.');
       }

해당 아이디가 존재하지 않는데 if(exUser === true) 에 걸려서 못넘어같은데 해당 원인을 찾지못하고있어 질문드립니다.

--------------------git주소------------------------

https://github.com/812jay/react-nodebird

---------------------------------------------------

감사합니다.

Next.jsnodejsreactreduxexpress

Answer 2

1

zerocho님의 프로필 이미지
zerocho
Instructor

exUser가 {}네요. if ({})는 true입니다.

exUser?.id 로 바꿔보세요.

0

yongje8120072님의 프로필 이미지
yongje8120072
Questioner

exUser = await User.findOne.... 으로 await 추가하니까 되네요~ 감사합니다!!

yongje8120072's profile image
yongje8120072

asked

Ask a question