From 356b287bffb69e1ce789791baa2b6996ae390684 Mon Sep 17 00:00:00 2001 From: BlueHorn07 Date: Thu, 26 Sep 2024 22:34:16 +0900 Subject: [PATCH 1/3] update https readme --- .env.example | 3 ++- certificates/README.md | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 301ec01..4b44be9 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ NEXT_PUBLIC_API=xxxx.poapper.com NEXT_PUBLIC_ENV={local, dev, prod} - +# only for local development +NODE_TLS_REJECT_UNAUTHORIZED=0 diff --git a/certificates/README.md b/certificates/README.md index a0b36e0..bd0c397 100644 --- a/certificates/README.md +++ b/certificates/README.md @@ -22,3 +22,17 @@ Sudo password: ``` 가이드 대로 본인의 root password를 입력하면, 루트 경로에 `certificates/`란 폴더에 `localhost-key.pem`과 `localhost.pem`이 생성되고, NextJS app을 https로 실행할 수 있다. + +## NODE_TLS_REJECT_UNAUTHORIZED + +ENV에 요 값을 아래와 같이 세팅해야 한다. + +``` +NODE_TLS_REJECT_UNAUTHORIZED=0 +``` + +그래야 self-signed cert를 사용해도 SSR과 API 요청을 할 수 있다. + +## Chrome Allow Insecure Localhost + +또, 크롬에서도 insecure localhost에 대한 접속을 허용해줘야 한다. `chrome://flags/#allow-insecure-localhost` 경로로 이동해서 해당 옵션을 Enabled로 바꾸자. From d84cc79d60c4cd4df7424de31c28ad5a7acaab10 Mon Sep 17 00:00:00 2001 From: BlueHorn07 Date: Thu, 26 Sep 2024 22:34:31 +0900 Subject: [PATCH 2/3] update styled component's name --- components/calendar/calendar.panel.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/calendar/calendar.panel.tsx b/components/calendar/calendar.panel.tsx index ced6eb3..4558bec 100644 --- a/components/calendar/calendar.panel.tsx +++ b/components/calendar/calendar.panel.tsx @@ -11,7 +11,7 @@ const CalendarPanel = ({ nextEvent }: { nextEvent: ICalendar }) => { ); return (
- +
{ {nextEvent.title}
({`${moment(nextEvent.event_date).format('MM월 DD일 dddd')}`})
-
+
); }; export default CalendarPanel; -const NoticeCard = styled.div` +const CalendarCard = styled.div` background: #eeeeee; border-radius: 0.4em; padding: 18px; From 7c1877649d21be33f48e63a783e4716d1cce92c6 Mon Sep 17 00:00:00 2001 From: BlueHorn07 Date: Thu, 26 Sep 2024 22:34:37 +0900 Subject: [PATCH 3/3] fix notice card --- components/notice/notice.card.tsx | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/components/notice/notice.card.tsx b/components/notice/notice.card.tsx index 658eb59..bdacd4c 100644 --- a/components/notice/notice.card.tsx +++ b/components/notice/notice.card.tsx @@ -17,21 +17,24 @@ const NoticeCard: React.FC = ({ notice, user }) => { const [isLike, setIsLike] = useState(false); const [likeCount, setLikeCount] = useState(0); + const user_id = user ? user.uuid : null; + const notice_id = notice.id; + useEffect(() => { const fetchLikeStatus = async () => { if (!user) return; - const status = await PoPoAxios.get('/noticeLike/status', { - params: { user: user.uuid, notice: notice.id }, - withCredentials: true, - }); + const status = await PoPoAxios.get( + `/noticeLike/status/${user_id}/${notice_id}`, + { + withCredentials: true, + }, + ); setIsLike(status.data); }; const fetchLikeCount = async () => { - const count = await PoPoAxios.get('/noticeLike/count', { - params: { notice: notice.id }, - }); + const count = await PoPoAxios.get(`/noticeLike/count/${notice_id}`); setLikeCount(count.data); }; @@ -46,27 +49,26 @@ const NoticeCard: React.FC = ({ notice, user }) => { return; } - const data = { user_id: user.uuid, notice_id: notice.id }; - if (isLike) { - await PoPoAxios.delete('/noticeLike', { - data, + await PoPoAxios.delete(`/noticeLike/${user_id}/${notice_id}`, { withCredentials: true, }) .then(() => setLikeCount(likeCount - 1)) .catch((err) => { const errMsg = err.response.data.message; alert(`공지 좋아요 취소에 실패했습니다.\n${errMsg}`); - console.log(data); console.log(err); }); } else { - await PoPoAxios.post('/noticeLike', data, { withCredentials: true }) + await PoPoAxios.post( + '/noticeLike', + { user_id: user_id, notice_id: notice_id }, + { withCredentials: true }, + ) .then(() => setLikeCount(likeCount + 1)) .catch((err) => { const errMsg = err.response.data.message; alert(`공지 좋아요에 실패했습니다.\n${errMsg}`); - console.log(data); console.log(err); }); }