HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🐣
프론트엔드 데브코스 4기 교육생
/
🍎
성기동팀
/
🪄
NIRVANA MANAGER
/
Profile 페이지 - getUser API
Profile 페이지 - getUser API
Profile 페이지 - getUser API

Profile 페이지 - getUser API

종류
react-query
작성자

getUser.tsx


해당 파일에서 반환하는 함수는 두가지 입니다.
  • getUser
    • 유저의 정보를 가져오는 함수
  • putUpdateUser
    • 유저의 정보를 업데이트하는 함수

getUser


userId 를 통해 사용자의 정보를 가져오고 반환합니다.
const getUser = async (userId: string) => { const response = await axios.get(`${API_BASE_URL}/users/${userId}`); return response.data; };

getUpdateUser


사용자의 이름을 업데이트합니다.
const putUpdateUser = async ({username, fullName, token}: PutUpdateUserParams) => { const response = await axios.put( `${API_BASE_URL}/settings/update-user`, { fullName, username }, { headers: { Authorization: token } } ); return response.data; };