Skip to content

Commit

Permalink
오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ipcgrdn committed Dec 20, 2024
1 parent 2b7c086 commit 23aeb36
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
29 changes: 17 additions & 12 deletions src/app/user/[userId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ export default function UserPage() {
<div className="md:text-3xl font-bold text-2xl pl-2">
{profileData?.name || "U"}
</div>
<div onClick={profileEditModal.onOpen} className="cursor-pointer">
<div
onClick={profileEditModal.onOpen}
className="cursor-pointer"
>
<IconDotsVertical className="size-6 hover:opacity-75" />
</div>
</div>
Expand All @@ -106,17 +109,19 @@ export default function UserPage() {
팔로우
</button>
</div>
<div className="flex md:mt-8 gap-x-2">
<IconLink className="size-6" />
<a
href={profileData?.link1}
target="_blank"
rel="noopener noreferrer"
className="text-sky-500"
>
{profileData?.link1}
</a>
</div>
{profileData?.link1 && (
<div className="flex md:mt-8 gap-x-2">
<IconLink className="size-6" />
<a
href={profileData?.link1}
target="_blank"
rel="noopener noreferrer"
className="text-sky-500"
>
{profileData?.link1}
</a>
</div>
)}
</div>
</div>

Expand Down
15 changes: 9 additions & 6 deletions src/components/modal/profileEdit-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const ProfileEditModal = () => {

setIsloading(true);

let requestData = { ...values };
const requestData = { ...values };

if (file) {
try {
Expand Down Expand Up @@ -140,16 +140,19 @@ const ProfileEditModal = () => {
{ withCredentials: true }
);

if (response.status !== 200) {
throw new Error("프로필 수정에 실패했습니다.");
}

toast.success("프로필이 수정되었습니다.");
reset();
profileEditModal.onClose();
} catch (error) {
if (axios.isAxiosError(error)) {
const errorMessage =
error.response?.data?.detail || "프로필 수정 중 오류가 발생했습니다.";
toast.error(errorMessage);
if (axios.isAxiosError(error) && error.response?.data) {
const errorData = error.response.data;
toast.error(errorData.detail || "프로필 수정 중 오류가 발생했습니다.");
} else {
toast.error("프로필 수정 오류가 발생했습니다.");
toast.error("프로필 수정 과정에서 오류가 발생했습니다.");
}
} finally {
setIsloading(false);
Expand Down

0 comments on commit 23aeb36

Please sign in to comment.