Skip to content

Conversation

@rimedang
Copy link

@rimedang rimedang commented Nov 14, 2025

Description

  • 유저페이지를 구현하였습니다.

Important content

Question

Reference

Image

Copy link

@hayoon07 hayoon07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

과제 통과입니당~
어떤 부분에서 오류가 났었는지 어떻게 해결했는지 궁금하네용
고생하셨습니다~~

Comment on lines +14 to +44
.get(`${API_URL}/users?_limit=5`) //테스트 API에서 게시글 5개 가져오기
.then((res) => setUsers(res.data)) // 받아온 데이터를 posts 상태에 저장
.catch((err) => console.error(err));
}, [API_URL]);

const addUser = (newUser) => {
// 이름 변경 (newUser는 name, email 객체)
axios
.post(`${API_URL}/users`, newUser) // users 엔드포인트
.then((res) => setUsers((prev) => [res.data, ...prev])); // setUsers
};

const updateUser = (updatedUser) => {
// 이름 변경
axios
.patch(
`${API_URL}/users/${updatedUser.id}`, // users 엔드포인트
updatedUser
)
.then((res) => {
setUsers(
(prev) => prev.map((u) => (u.id === updatedUser.id ? res.data : u)) // p -> u
);
});
};

// DELETE: 게시글 삭제
const deleteUser = (id) => {
// 이름 변경
axios
.delete(`${API_URL}/users/${id}`) // users 엔드포인트

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@hayoon07 hayoon07 added the ✅ 과제 통과 조지미에게 과제 확인을 받아 과제 통과한 상태입니다. label Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✅ 과제 통과 조지미에게 과제 확인을 받아 과제 통과한 상태입니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants