From 2314228522bcb7b7dc7387d2445e945520cbcb85 Mon Sep 17 00:00:00 2001 From: Seungyeon Han Date: Thu, 27 Feb 2025 11:23:38 +0900 Subject: [PATCH 01/14] =?UTF-8?q?feat:=20=EA=B3=B5=EC=9C=A0=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EA=B8=80=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/share.ts | 45 +++++++++++++++++-- .../Home/components/ShowShareAccessModal.tsx | 38 ++++++++++------ 2 files changed, 67 insertions(+), 16 deletions(-) diff --git a/src/apis/share.ts b/src/apis/share.ts index 447037a..4d194b8 100644 --- a/src/apis/share.ts +++ b/src/apis/share.ts @@ -1,5 +1,44 @@ import client from './client'; +// 공유 게시글 목록 조회 타입 +export interface SharePost { + writerZipCode: number; + receiverZipCode: number; + content: string; + createdAt: string; + active: boolean; + sharePostId: number; + sharePostContent: string; +} + +// 페이징 포함 +export interface SharePostResponse { + content: SharePost[]; + currentPage: number; + size: number; + totalElements: number; + totalPages: number; +} + +// 공유 게시글 목록 조회 +export const getSharePostList = async ( + page: number = 1, + size: number = 10, +): Promise => { + try { + const response = await client.get('/api/share-posts', { + params: { page, size }, + }); + console.log(`🌟공유 게시글 목록`, response.data); + + return response.data; + } catch (error) { + console.error('❌ 편지 공유 게시글 목록을 조회하던 중 에러가 발생했습니다', error); + throw new Error('편지 공유 게시글 목록 조회 실패'); + } +}; + +// 공유 요청 보내기 export const postShareProposals = async ( letterIds: number[], requesterId: number, @@ -9,9 +48,9 @@ export const postShareProposals = async ( try { const response = await client.post('/api/share-proposals', { letterIds: letterIds, - requesterId: requesterId, - recipientId: recipientId, - message: message, + requesterId, + recipientId, + message, }); if (!response) throw new Error('error while fetching mailbox data'); return response; diff --git a/src/pages/Home/components/ShowShareAccessModal.tsx b/src/pages/Home/components/ShowShareAccessModal.tsx index 21d6c98..f50d13a 100644 --- a/src/pages/Home/components/ShowShareAccessModal.tsx +++ b/src/pages/Home/components/ShowShareAccessModal.tsx @@ -1,6 +1,8 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { useNavigate } from 'react-router'; +import { getSharePostList } from '@/apis/share'; +import { SharePostResponse } from '@/apis/share'; import ModalBackgroundWrapper from '@/components/ModalBackgroundWrapper'; import ModalOverlay from '@/components/ModalOverlay'; @@ -9,21 +11,31 @@ interface ShowShareAccessModalProps { onClose: () => void; } -const DUMMY_SHARE_ACCESS = [ - { id: 1, zip_code: '235EA' }, - { id: 2, zip_code: '711PO' }, - { id: 3, zip_code: '105CF' }, - { id: 4, zip_code: '299EB' }, -]; - const ShowShareAccessModal = ({ onClose }: ShowShareAccessModalProps) => { const navigate = useNavigate(); + const [sharePosts, setSharePosts] = useState(); + + useEffect(() => { + const fetchPosts = async () => { + try { + const data = await getSharePostList(1, 10); + setSharePosts(data); + // console.log(data); + } catch (error) { + console.error('❌ 게시글 목록을 불러오는 데 실패했습니다.', error); + } + }; + + fetchPosts(); + }, []); + + const handleNavigation = (accessId: number) => { navigate(`/board/letter/${accessId}`, { state: { isShareLetterPreview: true }, }); - }; + return (
@@ -40,13 +52,13 @@ const ShowShareAccessModal = ({ onClose }: ShowShareAccessModalProps) => {

- {DUMMY_SHARE_ACCESS.map((access) => ( + {sharePosts?.content.map((post) => ( ))}
From d494ef274184747895ee33e889100bde7d816a7a Mon Sep 17 00:00:00 2001 From: Seungyeon Han Date: Thu, 27 Feb 2025 11:24:35 +0900 Subject: [PATCH 02/14] =?UTF-8?q?feat:=20=EA=B3=B5=EC=9C=A0=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EA=B8=80=20=EC=83=81=EC=84=B8=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/share.ts | 26 ++++++++- .../Home/components/ShowShareAccessModal.tsx | 17 +++--- .../LetterBoardDetail/components/Letter.tsx | 14 ++--- src/pages/LetterBoardDetail/index.tsx | 54 +++++++++++-------- 4 files changed, 75 insertions(+), 36 deletions(-) diff --git a/src/apis/share.ts b/src/apis/share.ts index 4d194b8..ee94111 100644 --- a/src/apis/share.ts +++ b/src/apis/share.ts @@ -1,5 +1,13 @@ import client from './client'; +//공유 게시글 상세 페이지 편지 +interface Letter { + id: number; + content: string; + writerZipCode: string; + receiverZipCode: string; +} + // 공유 게시글 목록 조회 타입 export interface SharePost { writerZipCode: number; @@ -9,6 +17,7 @@ export interface SharePost { active: boolean; sharePostId: number; sharePostContent: string; + letters: Letter[]; } // 페이징 포함 @@ -38,6 +47,18 @@ export const getSharePostList = async ( } }; +// 공유 게시글 상세 조회 +export const getSharePostDetail = async (sharePostId: number): Promise => { + try { + const response = await client.get(`/api/share-posts/${sharePostId}`); + console.log(`🔥공유 게시글 상세 데이터`, response.data); + return response.data.data; + } catch (error) { + console.error('❌ 편지 공유 게시글을 상세 조회하던 중 에러가 발생했습니다', error); + throw new Error('편지 공유 게시글 상세 조회 실패'); + } +}; + // 공유 요청 보내기 export const postShareProposals = async ( letterIds: number[], @@ -53,8 +74,9 @@ export const postShareProposals = async ( message, }); if (!response) throw new Error('error while fetching mailbox data'); - return response; + return response.data; } catch (error) { - console.error(error); + console.error('❌ 공유 요청 보내기 중 에러가 발생했습니다', error); + throw new Error('공유 요청 실패'); } }; diff --git a/src/pages/Home/components/ShowShareAccessModal.tsx b/src/pages/Home/components/ShowShareAccessModal.tsx index f50d13a..08705ad 100644 --- a/src/pages/Home/components/ShowShareAccessModal.tsx +++ b/src/pages/Home/components/ShowShareAccessModal.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import { useNavigate } from 'react-router'; -import { getSharePostList } from '@/apis/share'; +import { getSharePostDetail, getSharePostList } from '@/apis/share'; import { SharePostResponse } from '@/apis/share'; import ModalBackgroundWrapper from '@/components/ModalBackgroundWrapper'; import ModalOverlay from '@/components/ModalOverlay'; @@ -30,11 +30,16 @@ const ShowShareAccessModal = ({ onClose }: ShowShareAccessModalProps) => { fetchPosts(); }, []); - - const handleNavigation = (accessId: number) => { - navigate(`/board/letter/${accessId}`, { - state: { isShareLetterPreview: true }, - }); + const handleNavigation = async (sharePostId: number) => { + try { + const postDetail = await getSharePostDetail(sharePostId); + navigate(`/board/letter/${sharePostId}`, { + state: { postDetail, isShareLetterPreview: true }, + }); + } catch (error) { + console.error('❌ 게시글 상세 페이지로 이동하는 데에 실패했습니다.', error); + } + }; return ( diff --git a/src/pages/LetterBoardDetail/components/Letter.tsx b/src/pages/LetterBoardDetail/components/Letter.tsx index c279b76..58c80a2 100644 --- a/src/pages/LetterBoardDetail/components/Letter.tsx +++ b/src/pages/LetterBoardDetail/components/Letter.tsx @@ -2,20 +2,20 @@ import MemoWrapper from '@/components/MemoWrapper'; interface LetterProps { letter: { - receiver: string; + receiverZipCode: string; content: string; - sender: string; + writerZipCode: string; }; - isSender?: boolean; + isWriter?: boolean; } -const Letter = ({ letter, isSender = false }: LetterProps) => { +const Letter = ({ letter, isWriter = false }: LetterProps) => { return ( - +
-

To. {letter.receiver}

+

To. {letter.receiverZipCode}

{letter.content}

-

From. {letter.sender}

+

From. {letter.writerZipCode}

); diff --git a/src/pages/LetterBoardDetail/index.tsx b/src/pages/LetterBoardDetail/index.tsx index 137eb67..d775064 100644 --- a/src/pages/LetterBoardDetail/index.tsx +++ b/src/pages/LetterBoardDetail/index.tsx @@ -1,20 +1,14 @@ -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { useLocation } from 'react-router'; import { twMerge } from 'tailwind-merge'; +import { getSharePostDetail, SharePost } from '@/apis/share'; import BlurImg from '@/assets/images/landing-blur.png'; import ReportModal from '@/components/ReportModal'; import Header from './components/Header'; import Letter from './components/Letter'; -const DUMMY_LETTER = { - receiver: '12E21', - content: - '편지 내용 어쩌구저쩌구 뾰로롱 편지 내용 어쩌구저쩌구 뾰로롱편지 내용 어쩌구 뾰로롱편지 내용 어쩌구 뾰로롱편지 내용 어쩌구 뾰로롱편지 내용 어쩌구 뾰로롱편지 내용 어쩌구 뾰로롱편지 내용 어쩌구 뾰로롱편지 내용 어쩌구 뾰로롱편지 내용 어쩌구 뾰로롱편지 내용 어쩌구 저쩌구 끝~!!', - sender: '12345', -}; - interface ShareLetterPreviewProps { confirmDisabled?: boolean; children?: React.ReactNode; @@ -39,8 +33,28 @@ const LetterBoardDetailPage = ({ const location = useLocation(); - const isShareLetterPreview = location.state?.isShareLetterPreview || false; // state가 없다면 false로 기본값 설정 - console.log(location); + const isShareLetterPreview = location.state?.isShareLetterPreview || false; + const [postDetail, setPostDetail] = useState(); + + useEffect(() => { + const fetchPostDetail = async () => { + try { + if (location.state?.postDetail) { + const { sharePostId } = location.state.postDetail; + + const data = await getSharePostDetail(sharePostId); + + setPostDetail(data); + } else { + console.warn('postDetail not found in location.state'); + } + } catch (error) { + console.error('❌ 공유 게시글 상세 조회에 실패했습니다.', error); + } + }; + + fetchPostDetail(); + }, [location.state]); return ( <> @@ -55,25 +69,23 @@ const LetterBoardDetailPage = ({ isShareLetterPreview={isShareLetterPreview} />
-

FROM. 12E31

+

FROM. {postDetail?.writerZipCode}

- 내가 최근 먀먀먀를 했음. 그런데 이런 고민을 부모님께 말씀드리기에는 너무 죄송했음. - 이런저런 조언을 구하지 못해 편지를 작성했는데 너무나도 따뜻한 조언과 이야기를 받고 힘이 - 났음. 다른 분들께도 내가 받았던 응원을 함께 공유하고 싶음. + {postDetail?.sharePostContent}

- - - - - - - + {postDetail?.letters.map((letter, index) => ( + + ))}
{isShareLetterPreview && ( From 8d1e9eadcc293bd20f7d2b0feecf2c1304dd935f Mon Sep 17 00:00:00 2001 From: Seungyeon Han Date: Sun, 2 Mar 2025 03:33:04 +0900 Subject: [PATCH 03/14] =?UTF-8?q?feat:=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20?= =?UTF-8?q?=EA=B3=B5=EC=9C=A0=20=EC=9A=94=EC=B2=AD=20=EC=88=98=EB=9D=BD/?= =?UTF-8?q?=EA=B1=B0=EC=A0=88=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/share.ts | 24 +++++++++++++ .../components/ShowIncomingLettersModal.tsx | 3 +- src/pages/LetterBoardDetail/index.tsx | 36 +++++++++++++------ 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/src/apis/share.ts b/src/apis/share.ts index ee94111..61b9e72 100644 --- a/src/apis/share.ts +++ b/src/apis/share.ts @@ -29,6 +29,13 @@ export interface SharePostResponse { totalPages: number; } +// 편지 공유 수락 / 거절 +export interface SharePostApproval { + shareProposalId: number; + status: 'APPROVED' | 'REJECTED'; + sharePostId: number; +} + // 공유 게시글 목록 조회 export const getSharePostList = async ( page: number = 1, @@ -80,3 +87,20 @@ export const postShareProposals = async ( throw new Error('공유 요청 실패'); } }; + +// 편지 공유 수락 / 거절 +export const postShareProposalApproval = async ( + shareProposalId: number, + action: 'approve' | 'reject', +): Promise => { + try { + const response = await client.patch(`/api/share-proposal/${shareProposalId}/${action}`); + return response.data; + } catch (error) { + console.error( + `❌ 편지 공유 ${action === 'approve' ? '수락' : '거절'} 중 에러가 발생했습니다`, + error, + ); + throw new Error(`편지 공유 ${action === 'approve' ? '수락' : '거부'} 실패`); + } +}; diff --git a/src/pages/Home/components/ShowIncomingLettersModal.tsx b/src/pages/Home/components/ShowIncomingLettersModal.tsx index 2259854..abc14f8 100644 --- a/src/pages/Home/components/ShowIncomingLettersModal.tsx +++ b/src/pages/Home/components/ShowIncomingLettersModal.tsx @@ -1,5 +1,6 @@ import React, { useEffect } from 'react'; import { useNavigate } from 'react-router'; + import ModalBackgroundWrapper from '@/components/ModalBackgroundWrapper'; import ModalOverlay from '@/components/ModalOverlay'; import { useIncomingLettersStore } from '@/stores/incomingLettersStore'; @@ -22,7 +23,7 @@ const ShowIncomingLettersModal = ({ onClose }: ShowIncomingLettersModalProps) => useEffect(() => { fetchIncomingLetters(); - }); + }, []); return ( diff --git a/src/pages/LetterBoardDetail/index.tsx b/src/pages/LetterBoardDetail/index.tsx index d775064..cb2320a 100644 --- a/src/pages/LetterBoardDetail/index.tsx +++ b/src/pages/LetterBoardDetail/index.tsx @@ -1,8 +1,8 @@ import { useEffect, useState } from 'react'; -import { useLocation } from 'react-router'; +import { useLocation, useNavigate } from 'react-router'; import { twMerge } from 'tailwind-merge'; -import { getSharePostDetail, SharePost } from '@/apis/share'; +import { getSharePostDetail, postShareProposalApproval, SharePost } from '@/apis/share'; import BlurImg from '@/assets/images/landing-blur.png'; import ReportModal from '@/components/ReportModal'; @@ -12,15 +12,9 @@ import Letter from './components/Letter'; interface ShareLetterPreviewProps { confirmDisabled?: boolean; children?: React.ReactNode; - onCancel?: () => void; - onConfirm?: () => void; } -const LetterBoardDetailPage = ({ - confirmDisabled, - onCancel, - onConfirm, -}: ShareLetterPreviewProps) => { +const LetterBoardDetailPage = ({ confirmDisabled }: ShareLetterPreviewProps) => { const [likeCount, setLikeCount] = useState(122); const [isLike, setIsLike] = useState(false); const isWriter = false; @@ -32,16 +26,21 @@ const LetterBoardDetailPage = ({ }; const location = useLocation(); + const navigate = useNavigate(); const isShareLetterPreview = location.state?.isShareLetterPreview || false; const [postDetail, setPostDetail] = useState(); useEffect(() => { const fetchPostDetail = async () => { + console.log('location.state:', location.state); + try { if (location.state?.postDetail) { const { sharePostId } = location.state.postDetail; + console.log('sharePostId:', sharePostId); + const data = await getSharePostDetail(sharePostId); setPostDetail(data); @@ -56,6 +55,20 @@ const LetterBoardDetailPage = ({ fetchPostDetail(); }, [location.state]); + const handleProposalApproval = async ( + action: 'approve' | 'reject', + shareProposalId: number = location.state?.postDetail?.sharePostId, + ) => { + try { + const result = await postShareProposalApproval(shareProposalId, action); + console.log(`✅ 편지 공유 ${action === 'approve' ? '수락' : '거절'}됨:`, result); + + navigate('/'); + } catch (error) { + console.error(error); + } + }; + return ( <> {activeReportModal && setActiveReportModal(false)} />} @@ -95,15 +108,16 @@ const LetterBoardDetailPage = ({ + From 1aab4b6ac45f916c69f760e83d563555b8ad3084 Mon Sep 17 00:00:00 2001 From: Seungyeon Han Date: Sun, 2 Mar 2025 17:19:47 +0900 Subject: [PATCH 04/14] =?UTF-8?q?perf:=20NewLetterModal=EC=9D=98=20?= =?UTF-8?q?=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20api=20=ED=98=B8=EC=B6=9C?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Home/components/NewLetterModal.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/pages/Home/components/NewLetterModal.tsx b/src/pages/Home/components/NewLetterModal.tsx index 5a33817..12ea53a 100644 --- a/src/pages/Home/components/NewLetterModal.tsx +++ b/src/pages/Home/components/NewLetterModal.tsx @@ -1,14 +1,8 @@ -import { useEffect } from 'react'; - import { useIncomingLettersStore } from '@/stores/incomingLettersStore'; //TODO: 내 편지함 상세 조회에서 해당 편지를 조회하면 arrivedCount가 1 감소하도록 const NewLetterModal = () => { - const { arrivedCount, fetchIncomingLetters } = useIncomingLettersStore(); - - useEffect(() => { - fetchIncomingLetters(); - }, []); + const { arrivedCount } = useIncomingLettersStore(); return (

From 043eba9cfb7266c32c26e341f036401c61a60dd4 Mon Sep 17 00:00:00 2001 From: Seungyeon Han Date: Sun, 2 Mar 2025 17:21:03 +0900 Subject: [PATCH 05/14] =?UTF-8?q?fix:=20HomeRight=EC=9D=98=20useEffect=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=20=EB=B0=B0=EC=97=B4=EC=97=90=20fet?= =?UTF-8?q?chIncomingLetters=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Home/components/HomeRight.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Home/components/HomeRight.tsx b/src/pages/Home/components/HomeRight.tsx index e8b32dc..9d20d0b 100644 --- a/src/pages/Home/components/HomeRight.tsx +++ b/src/pages/Home/components/HomeRight.tsx @@ -11,7 +11,7 @@ const HomeRight = () => { const { arrivedCount, fetchIncomingLetters } = useIncomingLettersStore(); useEffect(() => { fetchIncomingLetters(); - }, []); + }, [fetchIncomingLetters]); return (

From d701aac716836f7aeaf7a875a6be0e772c9e64cc Mon Sep 17 00:00:00 2001 From: Seungyeon Han Date: Sun, 2 Mar 2025 17:35:14 +0900 Subject: [PATCH 06/14] =?UTF-8?q?fix:=20=EA=B3=B5=EC=9C=A0=20=ED=8E=B8?= =?UTF-8?q?=EC=A7=80=20=EB=AF=B8=EB=A6=AC=EB=B3=B4=EA=B8=B0=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=ED=85=8D=EC=8A=A4=ED=8A=B8=EC=99=80=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=EC=9D=B4=20=EA=B2=B9=EC=B3=90=EB=B3=B4=EC=9D=B4?= =?UTF-8?q?=EB=8A=94=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/LetterBoardDetail/index.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/pages/LetterBoardDetail/index.tsx b/src/pages/LetterBoardDetail/index.tsx index cb2320a..6637211 100644 --- a/src/pages/LetterBoardDetail/index.tsx +++ b/src/pages/LetterBoardDetail/index.tsx @@ -99,12 +99,26 @@ const LetterBoardDetailPage = ({ confirmDisabled }: ShareLetterPreviewProps) => isWriter={letter.writerZipCode === String(postDetail.receiverZipCode)} /> ))} + {postDetail?.letters.map((letter, index) => ( + + ))} + {postDetail?.letters.map((letter, index) => ( + + ))} {isShareLetterPreview && ( <> - landing blur -
+ landing blur +
{isShareLetterPreview && ( From c5d82c99db600ef00bd79351c35a328e5017f1e8 Mon Sep 17 00:00:00 2001 From: Seungyeon Han Date: Sun, 2 Mar 2025 20:36:30 +0900 Subject: [PATCH 13/14] =?UTF-8?q?refactor:=20'Letter'=20=EC=9D=B8=ED=84=B0?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EC=9D=B4=EB=A6=84=EC=9D=84=20'Sh?= =?UTF-8?q?areLetter'=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/share.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apis/share.ts b/src/apis/share.ts index 61b9e72..8f43c95 100644 --- a/src/apis/share.ts +++ b/src/apis/share.ts @@ -1,7 +1,7 @@ import client from './client'; //공유 게시글 상세 페이지 편지 -interface Letter { +interface ShareLetter { id: number; content: string; writerZipCode: string; @@ -17,7 +17,7 @@ export interface SharePost { active: boolean; sharePostId: number; sharePostContent: string; - letters: Letter[]; + letters: ShareLetter[]; } // 페이징 포함 From 5fe11526771b7f6c49cd5fa36afff6dc568682f6 Mon Sep 17 00:00:00 2001 From: Seungyeon Han Date: Sun, 2 Mar 2025 20:39:00 +0900 Subject: [PATCH 14/14] =?UTF-8?q?fix:=20selector=EB=A1=9C=20=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EA=B0=92=EB=A7=8C=20=EB=B6=88=EB=9F=AC?= =?UTF-8?q?=EC=98=A4=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20=EB=A0=8C?= =?UTF-8?q?=EB=8D=94=EB=A7=81=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Home/components/GoToLetterBox.tsx | 2 +- src/pages/Home/components/NewLetterModal.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Home/components/GoToLetterBox.tsx b/src/pages/Home/components/GoToLetterBox.tsx index 4250f7c..54bef21 100644 --- a/src/pages/Home/components/GoToLetterBox.tsx +++ b/src/pages/Home/components/GoToLetterBox.tsx @@ -5,7 +5,7 @@ import goToLetterBox from '@/assets/images/go-to-letter-box.png'; import { useIncomingLettersStore } from '@/stores/incomingLettersStore'; const GoToLetterBox = () => { - const { arrivedCount } = useIncomingLettersStore(); + const arrivedCount = useIncomingLettersStore((state) => state.arrivedCount); return (
diff --git a/src/pages/Home/components/NewLetterModal.tsx b/src/pages/Home/components/NewLetterModal.tsx index 12ea53a..03614c0 100644 --- a/src/pages/Home/components/NewLetterModal.tsx +++ b/src/pages/Home/components/NewLetterModal.tsx @@ -2,7 +2,7 @@ import { useIncomingLettersStore } from '@/stores/incomingLettersStore'; //TODO: 내 편지함 상세 조회에서 해당 편지를 조회하면 arrivedCount가 1 감소하도록 const NewLetterModal = () => { - const { arrivedCount } = useIncomingLettersStore(); + const arrivedCount = useIncomingLettersStore((state) => state.arrivedCount); return (