Skip to content

Commit b0d7161

Browse files
committed
feat:편지삭제 api 생성
1 parent dce8d2e commit b0d7161

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/apis/letterDetail.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,14 @@ const getLetter = async (
1313
}
1414
};
1515

16-
export { getLetter };
16+
const deleteLetter = async (letterId: string) => {
17+
try {
18+
console.log(`/api/letters/${letterId}`);
19+
const res = await client.delete(`/api/letters/${letterId}`);
20+
console.log(res);
21+
} catch (error) {
22+
console.error(error);
23+
}
24+
};
25+
26+
export { getLetter, deleteLetter };

src/pages/LetterDetail/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { useEffect, useRef, useState } from 'react';
22
import { useNavigate, useParams } from 'react-router';
33
import { twMerge } from 'tailwind-merge';
44

5-
import { getLetter } from '@/apis/letterDetail';
5+
import { deleteLetter, getLetter } from '@/apis/letterDetail';
66
import { CloudIcon, SirenOutlinedIcon, SnowIcon, ThermostatIcon, WarmIcon } from '@/assets/icons';
77
import ReportModal from '@/components/ReportModal';
8-
import { FONT_TYPE_OBJ, PAPER_TYPE_OBJ } from '../Write/constants';
8+
import { FONT_TYPE_OBJ, PAPER_TYPE_OBJ } from '@/pages/Write/constants';
99

1010
const LetterDetailPage = () => {
1111
const params = useParams();
@@ -33,6 +33,8 @@ const LetterDetailPage = () => {
3333
document.body.addEventListener('click', handleOutsideClick);
3434
if (params.id) {
3535
getLetter(params.id, setLetterDetail);
36+
// 편지 삭제 요청 테스트(내일 삭제 버튼 만들어서 여기다 추가하긔)
37+
deleteLetter(params.id);
3638
}
3739

3840
return () => {

0 commit comments

Comments
 (0)