id
라는 값이 필수 요소인데 uid
라고 저장해서 error가 뜬거였다.uid
를 id
로 고치니까 잘 저장된다.TypeError: Cannot read properties of undefined (reading 'id')
// SignUp.tsx
let userInfo = {
age: signUpInput.age,
email: signUpInput.email,
gender: signUpInput.gender,
nickName: signUpInput.nickName,
phoneNumber: signUpInput.phoneNumber,
profileImg: user.photoURL,
id: user.uid,
};
axios.post('http://localhost:3010/users', userInfo)
// users.json
{
"users": [
{
"age": "20대",
"email": "abcwockd95@naver.com",
"gender": "남자",
"nickName": null,
"phoneNumber": "01010111010",
"profileImg": null,
"id": "28ydef0rWWPfoH3Xd1pK7XlGcko1"
}
]
}