From cbfda9b9cbe060deaa9d3389405769525edacf17 Mon Sep 17 00:00:00 2001 From: JIN921 Date: Wed, 13 Nov 2024 13:43:26 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=ED=99=88=20=ED=8F=AC=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=97=86=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(afterLogin)/home/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/(afterLogin)/home/page.tsx b/src/app/(afterLogin)/home/page.tsx index 21ff006..aedfbd5 100644 --- a/src/app/(afterLogin)/home/page.tsx +++ b/src/app/(afterLogin)/home/page.tsx @@ -81,7 +81,7 @@ export default function Home() { )) ) : ( -
No posts available
+
)} ); From 33410e6c372dbd07063f429d9eb83851a0de2322 Mon Sep 17 00:00:00 2001 From: JIN921 Date: Wed, 13 Nov 2024 22:03:29 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20post=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=20=EC=95=88=20=EB=9C=A8=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(afterLogin)/_component/Post.tsx | 2 +- .../(afterLogin)/_component/PostImages.tsx | 68 ++++++++++--------- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/app/(afterLogin)/_component/Post.tsx b/src/app/(afterLogin)/_component/Post.tsx index db0a112..3107a8b 100644 --- a/src/app/(afterLogin)/_component/Post.tsx +++ b/src/app/(afterLogin)/_component/Post.tsx @@ -26,7 +26,7 @@ export default function Post({ post }: { post: any }) { } // 이미지 유효하지 않은 경우 디폴트 이미지 적용 - const profileImageUrl = post?.user?.profileImage?.link || "/default_profile_img.svg"; + const profileImageUrl = post?.user?.profileImage?.url || "/default_profile_img.svg"; return ( diff --git a/src/app/(afterLogin)/_component/PostImages.tsx b/src/app/(afterLogin)/_component/PostImages.tsx index 1a4203f..89b2334 100644 --- a/src/app/(afterLogin)/_component/PostImages.tsx +++ b/src/app/(afterLogin)/_component/PostImages.tsx @@ -10,50 +10,56 @@ import { } from "./PostStyle"; type Image = { - imageId: number; - link: string; + id: number; + url: string; }; type Props = { post: { postId: number; content: string; - User: { - id: string; - nickname: string; - image: string; + user: { + userId: number; + name: string; + customId: string; + profileImage: { + name: string; + url: string; + }; }; - createdAt: Date; - Images: Image[]; + createdAt: string; + images: Image[]; }; }; export default function PostImages({ post }: Props) { - if (!post?.Images || post?.Images.length === 0) return null; + if (!post?.images || post?.images.length === 0) return null; - if (post.Images.length === 1) { - const image = post.Images[0]; + console.log(post.images); // post.images가 제대로 출력되는지 확인 + + if (post.images.length === 1) { + const image = post.images[0]; return ( - {`image-${image.imageId}`} + {`image-${image.id}`} ); } - if (post.Images.length === 2) { + if (post.images.length === 2) { return ( - {post.Images.map((image) => ( + {post.images.map((image) => ( ))} @@ -61,22 +67,22 @@ export default function PostImages({ post }: Props) { ); } - if (post.Images.length === 3) { + if (post.images.length === 3) { return ( @@ -84,15 +90,15 @@ export default function PostImages({ post }: Props) { ); } - if (post.Images.length === 4) { + if (post.images.length === 4) { return ( - {post.Images.map((image) => ( + {post.images.map((image) => ( ))}