Skip to content

Commit 26a9716

Browse files
committed
fix: api 호출 오류 업데이트
1 parent 5b69958 commit 26a9716

File tree

5 files changed

+31
-32
lines changed

5 files changed

+31
-32
lines changed

src/pages/Landing/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
22
import { Navigate, useNavigate } from 'react-router';
33
import { twMerge } from 'tailwind-merge';
44

5-
import LandingImg from '@/assets/images/landing.png';
5+
import LandingImg from '@/assets/images/landing.webp';
66
import LandingImgDark from '@/assets/images/landing-dark.webp';
77
import useAuthStore from '@/stores/authStore';
88
import useThemeStore from '@/stores/themeStore';

src/pages/LetterBoard/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ const LetterBoardPage = () => {
9292
})}
9393
</section>
9494
) : (
95-
<p className="body-m text-gray-60 mt-10 text-center">게시글이 없습니다.</p>
95+
<p className="body-m text-gray-60 mt-10 text-center dark:text-white">
96+
게시글이 없습니다.
97+
</p>
9698
)
9799
) : (
98-
<p className="body-m text-gray-60 mt-10 text-center">
100+
<p className="body-m text-gray-60 mt-10 text-center dark:text-white">
99101
오류가 발생했습니다. 다시 한 번 시도해주세요
100102
</p>
101103
)}

src/pages/LetterBoardDetail/components/Header.tsx

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const Header = ({
2525
onToggleLike,
2626
onOpenReportModal,
2727
onDeleteLetter,
28-
isShareLetterPreview = false,
2928
}: HeaderProps) => {
3029
const navigate = useNavigate();
3130
return (
@@ -34,27 +33,25 @@ const Header = ({
3433
<button onClick={() => navigate(-1)}>
3534
<ArrowLeftIcon className="text-primary-1 h-6 w-6" />
3635
</button>
37-
{!isShareLetterPreview && (
38-
<div className="flex items-center gap-3">
39-
<div className="flex items-center gap-1">
40-
<button type="button" onClick={onToggleLike}>
41-
{isLike ? (
42-
<LikeFilledIcon className="text-primary-1 h-6 w-6" />
43-
) : (
44-
<LikeOutlinedIcon className="text-primary-1 h-6 w-6" />
45-
)}
46-
</button>
47-
<p className="body-l-m text-primary-1">{likeCount}</p>
48-
</div>
49-
{isWriter ? (
50-
<DeleteIcon className="text-primary-1 h-6 w-6" onClick={onDeleteLetter} />
51-
) : (
52-
<button type="button" onClick={onOpenReportModal}>
53-
<SirenOutlinedIcon className="text-primary-1 h-6 w-6" />
54-
</button>
55-
)}
36+
<div className="flex items-center gap-3">
37+
<div className="flex items-center gap-1">
38+
<button type="button" onClick={onToggleLike}>
39+
{isLike ? (
40+
<LikeFilledIcon className="text-primary-1 h-6 w-6" />
41+
) : (
42+
<LikeOutlinedIcon className="text-primary-1 h-6 w-6" />
43+
)}
44+
</button>
45+
<p className="body-l-m text-primary-1">{likeCount}</p>
5646
</div>
57-
)}
47+
{isWriter ? (
48+
<DeleteIcon className="text-primary-1 h-6 w-6" onClick={onDeleteLetter} />
49+
) : (
50+
<button type="button" onClick={onOpenReportModal}>
51+
<SirenOutlinedIcon className="text-primary-1 h-6 w-6" />
52+
</button>
53+
)}
54+
</div>
5855
</div>
5956
<div className="h-4 w-full bg-gradient-to-b from-white to-white/0" />
6057
</header>

src/pages/LetterBoardDetail/index.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ const LetterBoardDetailPage = () => {
7373
try {
7474
const data = await getSharePostDetail(postId);
7575
setPostDetail(data);
76+
if (myZipCode === data.zipCode || !data.zipCode) {
77+
setIsWriter(true);
78+
}
7679
} catch (error) {
7780
console.error('❌ 공유 게시글 상세 조회에 실패했습니다.', error);
7881
}
@@ -85,13 +88,6 @@ const LetterBoardDetailPage = () => {
8588
console.log('✅ 편지 좋아요 갯수:', response);
8689
setLikeCount(response.likeCount);
8790
setIsLike(response.liked);
88-
console.log('myZip', myZipCode);
89-
console.log('responseZip', response.zipCode);
90-
console.log('responseZip', response);
91-
92-
if (myZipCode === response.zipCode || !response.zipCode) {
93-
setIsWriter(true);
94-
}
9591
} catch (error) {
9692
console.error('❌ 편지 좋아요 갯수를 가져오는 중 에러가 발생했습니다', error);
9793
throw new Error('편지 좋아요 갯수 가져오기 실패');

src/pages/LetterBoxDetail/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ const LetterBoxDetailPage = () => {
6868
}, [inView, hasNextPage, isFetchingNextPage, fetchNextPage]);
6969

7070
const disconnectMutation = useMutation({
71-
mutationFn: async () => await postMailboxDisconnect(userInfo.oppositeId),
71+
mutationFn: async () => {
72+
console.log('userInfo', userInfo, userInfo.id);
73+
const response = await postMailboxDisconnect(userInfo.id);
74+
if (!response) throw new Error(`no response`);
75+
},
7276
onSuccess: () => {
7377
navigate(-1);
7478
setToastActive({

0 commit comments

Comments
 (0)