async authorize(credentials) {
dbConnect();
const user = await User.findOne({id : credentials.id})
if (!user) {
return null
}
const pwcheck = await bcrypt.compare(credentials.password, user.password);
if (!pwcheck) {
return null
}
return user
}
이 함수 내에서 아이디가 존재하지 않거나 비밀번호가 틀렸을 때 에러 메시지를 어떻게 클라이언트로 보낼 수 있을까요?