diff --git a/frontend/src/auth/profile.tsx b/frontend/src/auth/profile.tsx index fe4f2c4e983cbce891e3bfd2ad43ca668b020997..6301d8f3d4b4f6c04669c5d32155818e672cf654 100644 --- a/frontend/src/auth/profile.tsx +++ b/frontend/src/auth/profile.tsx @@ -47,32 +47,39 @@ export default function Profile() { const userChange = async () => { const profile = await handleProfile(); setEmail(profile.email); - setPicturename(profile.avatar.newfilename); - setPlaceholder(profile.avatar.nickname); + setPicturename(profile.fileInfo.newfilename); + setPlaceholder(profile.fileInfo.nickname); }; const handleClick = async ( e: React.MouseEvent ) => { + e.preventDefault(); const formdata = new FormData(); if (!(file === undefined || nickname === "")) { formdata.append("picture", file); formdata.append("nickname", nickname); console.log("both"); - await profileApi.picture(formdata); + await profileApi.profileUpload(formdata); } else if (!(nickname === "")) { formdata.append("nickname", nickname); console.log("picture"); - await profileApi.picture(formdata); + await profileApi.profileUpload(formdata); + } else if (!(file === undefined)) { + formdata.append("picture", file); + await profileApi.profileUpload(formdata); } else { alert("수정할 정보를 입력해주세요."); } }; const deleteClick = async () => { - await profileApi.deleteUser().then(() => { - logout(); - console.log("test"); - }); + if (confirm("삭제하시겠습니까?") == true) { + const success = await profileApi.deleteUser(); + if (success) { + await logout(); + } + } else { + } }; useEffect(() => {