From f26c3ff9de84c4d6ca18c5cbbd6ce81e1b7e8525 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EA=B9=80=ED=98=95=EA=B2=B8?=
<97586683+Brokyeom@users.noreply.github.com>
Date: Thu, 21 Jul 2022 17:20:27 +0900
Subject: [PATCH 1/5] =?UTF-8?q?[=20=20chore=20=20]=20img=20=EC=97=B0?=
=?UTF-8?q?=EC=82=B0=EC=9E=90=20=EC=BD=94=EB=93=9C=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/community/ContentCard.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/community/ContentCard.tsx b/components/community/ContentCard.tsx
index f4d2024..3fb8adb 100644
--- a/components/community/ContentCard.tsx
+++ b/components/community/ContentCard.tsx
@@ -50,7 +50,7 @@ export default function ContentCard(props: ContentInfoProps) {
{replyCount}
- {img === undefined ? <>> : }
+ {img && }
);
}
From 49bd064e248609dcaa601b38c62b4084b1b9cbf7 Mon Sep 17 00:00:00 2001
From: Brokyeom
Date: Thu, 21 Jul 2022 18:52:57 +0900
Subject: [PATCH 2/5] =?UTF-8?q?[=20=20chore=20=20]=20=EB=8B=A8=EC=88=9C=20?=
=?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/community/ContentCard.tsx | 4 ++--
components/community/ReplyList.tsx | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/components/community/ContentCard.tsx b/components/community/ContentCard.tsx
index 3fb8adb..cf94da1 100644
--- a/components/community/ContentCard.tsx
+++ b/components/community/ContentCard.tsx
@@ -12,7 +12,7 @@ interface ContentInfoProps {
content: string;
userNickname?: string;
replyCount?: number;
- createdAt?: string;
+ createdAt: string;
img?: string;
}
@@ -41,7 +41,7 @@ export default function ContentCard(props: ContentInfoProps) {
{userNickname}
- {createdAt}
+ {createdAt.split('T')[0]}
diff --git a/components/community/ReplyList.tsx b/components/community/ReplyList.tsx
index 756ba5f..1cf979a 100644
--- a/components/community/ReplyList.tsx
+++ b/components/community/ReplyList.tsx
@@ -45,7 +45,7 @@ export default function ReplyList(props: ReplyListProps) {
const data = await postReply(newReplyInfo);
setNewReplyInfo({
- boardId: `${cid}`,
+ boardId: cid,
content: replyText,
});
router.push(`/community/${data.id}`);
From 6a6abffd52bb34d8b75b6efdc64856423cb3bbb7 Mon Sep 17 00:00:00 2001
From: Brokyeom
Date: Thu, 21 Jul 2022 18:52:57 +0900
Subject: [PATCH 3/5] =?UTF-8?q?[=20=20chore=20=20]=20=EB=8B=A8=EC=88=9C=20?=
=?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/community/ContentCard.tsx | 4 ++--
components/community/ReplyList.tsx | 6 +++---
core/axios.ts | 6 ++++--
pages/community/index.tsx | 1 -
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/components/community/ContentCard.tsx b/components/community/ContentCard.tsx
index 3fb8adb..cf94da1 100644
--- a/components/community/ContentCard.tsx
+++ b/components/community/ContentCard.tsx
@@ -12,7 +12,7 @@ interface ContentInfoProps {
content: string;
userNickname?: string;
replyCount?: number;
- createdAt?: string;
+ createdAt: string;
img?: string;
}
@@ -41,7 +41,7 @@ export default function ContentCard(props: ContentInfoProps) {
{userNickname}
- {createdAt}
+ {createdAt.split('T')[0]}
diff --git a/components/community/ReplyList.tsx b/components/community/ReplyList.tsx
index 756ba5f..92f92d1 100644
--- a/components/community/ReplyList.tsx
+++ b/components/community/ReplyList.tsx
@@ -43,12 +43,12 @@ export default function ReplyList(props: ReplyListProps) {
return;
}
- const data = await postReply(newReplyInfo);
+ const res = await postReply(newReplyInfo);
setNewReplyInfo({
- boardId: `${cid}`,
+ boardId: cid,
content: replyText,
});
- router.push(`/community/${data.id}`);
+ router.push({ pathname: `/community/${cid}` });
};
const handleCurrentPage = (nextPage: number) => {
setCurrentPage(nextPage);
diff --git a/core/axios.ts b/core/axios.ts
index 117ac55..0c3a9ca 100644
--- a/core/axios.ts
+++ b/core/axios.ts
@@ -13,8 +13,10 @@ const baseInstance = axios.create({
baseInstance.interceptors.request.use((config) => {
const headers = {
...config.headers,
- accessToken: LocalStorage.getItem('accessToken'),
- refreshToken: LocalStorage.getItem('refreshToken'),
+ accessToken:
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MzAsImlhdCI6MTY1ODM5MjA1NCwiZXhwIjoxNjU4Mzk5MjU0LCJpc3MiOiJub3JpIn0.-4zFiA6OVE5L86D0LWyEkyKf7RKvm7qlOG5NWCXcSYM',
+ refreshToken:
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MzAsImlhdCI6MTY1ODM4NDEwMCwiZXhwIjoxNjU5NTkzNzAwLCJpc3MiOiJub3JpIn0.AeuhSmM1ZqItojeM3O0SwrELog-Qfq91r_ii0EMgPig',
};
return { ...config, headers };
diff --git a/pages/community/index.tsx b/pages/community/index.tsx
index ebeb244..aa97283 100644
--- a/pages/community/index.tsx
+++ b/pages/community/index.tsx
@@ -17,7 +17,6 @@ const limit = 20;
export const getServerSideProps: GetServerSideProps = async () => {
const res = await getCommunity();
- // const data: CommunityData[] = communityMockData;
return {
props: res.data,
};
From 45a0f7d353838510d13a29a257af221c13bb6f61 Mon Sep 17 00:00:00 2001
From: Brokyeom
Date: Fri, 22 Jul 2022 00:18:24 +0900
Subject: [PATCH 4/5] =?UTF-8?q?[=20=20feat=20=20]=20=EB=8C=93=EA=B8=80=20p?=
=?UTF-8?q?ost=20=EC=97=B0=EA=B2=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/community/ReplyContent.tsx | 2 +-
components/community/ReplyList.tsx | 17 +++++++----------
core/api/community.ts | 4 ++--
pages/community/[cid].tsx | 2 +-
4 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/components/community/ReplyContent.tsx b/components/community/ReplyContent.tsx
index 53533ff..b0abf93 100644
--- a/components/community/ReplyContent.tsx
+++ b/components/community/ReplyContent.tsx
@@ -21,7 +21,7 @@ export default function ReplyContent(props: ReplyContentProps) {
{content}
- {createAt} · {author ? '삭제' : '신고'}
+ {createAt.split('T')[0]} · {author ? '삭제' : '신고'}
diff --git a/components/community/ReplyList.tsx b/components/community/ReplyList.tsx
index 963bc72..93fc0cf 100644
--- a/components/community/ReplyList.tsx
+++ b/components/community/ReplyList.tsx
@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
-import { useState, useEffect } from 'react';
+import { useState, useEffect, InputHTMLAttributes } from 'react';
import { postReply } from '../../core/api/community';
import {
CommunityData,
@@ -28,16 +28,12 @@ export default function ReplyList(props: ReplyListProps) {
const [pageReplyList, setPageReplyList] = useState([]);
const [isFirst, setIsFirst] = useState(true);
- console.log('=========================');
- console.log(replyList);
-
const handleInputText = (e: React.ChangeEvent) => {
- setReplyText(e.target.value);
- setNewReplyInfo({ ...newReplyInfo, content: e.target.value });
+ setNewReplyInfo({ boardId: cid, content: e.target.value });
};
- const handleInputColor = () => {
- setInputColor(replyText.length !== 0);
+ const handleInputColor = (e: any) => {
+ setInputColor(e.target.value.length !== 0);
};
const handleReplyregister = async () => {
@@ -47,12 +43,13 @@ export default function ReplyList(props: ReplyListProps) {
return;
}
- const res = await postReply(newReplyInfo);
+ const status = await postReply(newReplyInfo);
setNewReplyInfo({
boardId: cid,
content: replyText,
});
- router.push({ pathname: `/community/${cid}` });
+ if (status === 200) router.push(`/community/${cid}`);
+ setNewReplyInfo({ boardId: cid, content: '' });
};
const handleCurrentPage = (nextPage: number) => {
setCurrentPage(nextPage);
diff --git a/core/api/community.ts b/core/api/community.ts
index 16d88b3..e1f28c3 100644
--- a/core/api/community.ts
+++ b/core/api/community.ts
@@ -53,8 +53,8 @@ export const putCommunity = async (id: string, body: PutCommunityBody) => {
export const postReply = async (body: PostCommentBody) => {
try {
- const { data } = await baseInstance.post('/board/comment', body);
- return data;
+ const { status } = await baseInstance.post('/board/comment', body);
+ return status;
} catch (e) {
console.log(e);
}
diff --git a/pages/community/[cid].tsx b/pages/community/[cid].tsx
index 4d3d079..f214467 100644
--- a/pages/community/[cid].tsx
+++ b/pages/community/[cid].tsx
@@ -102,7 +102,7 @@ export default function CommunityDetail({
Date: Fri, 22 Jul 2022 00:18:51 +0900
Subject: [PATCH 5/5] =?UTF-8?q?[=20=20style=20=20]=20=EC=9D=B4=EB=AF=B8?=
=?UTF-8?q?=EC=A7=80=20=EC=9C=A0=EB=AC=B4=EC=97=90=20=EB=94=B0=EB=A5=B8=20?=
=?UTF-8?q?width=20=EC=A1=B0=EC=A0=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/community/ContentCard.tsx | 37 +++++++++++++++++++++-------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/components/community/ContentCard.tsx b/components/community/ContentCard.tsx
index 3f31fa5..852cb8c 100644
--- a/components/community/ContentCard.tsx
+++ b/components/community/ContentCard.tsx
@@ -30,12 +30,21 @@ export default function ContentCard(props: ContentInfoProps) {
- Router.push({ pathname: `/community/${id}` })}
- >
- {title}
- {content}
-
+ {!img ? (
+ Router.push({ pathname: `/community/${id}` })}
+ >
+ {title}
+ {content}
+
+ ) : (
+ Router.push({ pathname: `/community/${id}` })}
+ >
+ {title}
+ {content}
+
+ )}
{userNickname}
@@ -48,7 +57,12 @@ export default function ContentCard(props: ContentInfoProps) {
{replyCount}
- {img && }
+ {img && (
+
+ )}
);
}
@@ -65,7 +79,6 @@ const StContentsCardWrapper = styled.div`
border-bottom: 0.1rem solid ${({ theme }) => theme.colors.gray005};
h1 {
- width: 92.3rem;
margin-top: 1.6rem;
margin-bottom: 0.7rem;
@@ -88,7 +101,13 @@ const StContentsCardWrapper = styled.div`
cursor: pointer;
}
`;
-const StMainInfo = styled.article``;
+const StMainInfo = styled.article`
+ width: 97.6rem;
+`;
+const StImgMainInfo = styled.article`
+ width: 72.5rem;
+ margin-right: 3.3rem;
+`;
const StContentInfo = styled.section`
display: flex;
flex-direction: column;