Skip to content

Commit 890a6d7

Browse files
committed
fix: 게시글 삭제 후 아카이브로 이동
1 parent 635bcef commit 890a6d7

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

components/post/delete-post-button.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Link from 'next/link';
1414
import React, { useState } from 'react';
1515

1616
interface PostDeleteButtonProps {
17-
archiveId: string;
17+
archiveId?: number;
1818
postId: string;
1919
}
2020

@@ -68,7 +68,13 @@ const PostDeleteButton = ({ archiveId, postId }: PostDeleteButtonProps) => {
6868
요약본이 삭제되었습니다.
6969
</DialogDescription>
7070
<DialogFooter>
71-
<Link href={`/archive?id=${archiveId}`}>
71+
<Link
72+
href={
73+
archiveId !== undefined
74+
? '/archive'
75+
: `/archive?id=${archiveId}`
76+
}
77+
>
7278
<Button size="lg" onClick={handleAcceptButtonClick}>
7379
확인
7480
</Button>

components/post/post-detail.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ const PostDetail: FunctionComponent<PostDetailProps> = ({
5555
>
5656
수정
5757
</Link>
58-
{/**
59-
* @todo fetchPost 응답으로 archiveId 받아 props 전달 필요
60-
*/}
61-
<DeletePostButton postId={id} archiveId={''} />
58+
<DeletePostButton postId={id} archiveId={archiveId} />
6259
</div>
6360
)}
6461
<a

0 commit comments

Comments
 (0)