This commit is contained in:
2025-11-29 14:27:01 +09:00
parent 91d14fdabf
commit 872a88866e
5 changed files with 761 additions and 219 deletions

View File

@@ -24,6 +24,7 @@ export default function AdminNoticeDetailPage() {
const [attachments, setAttachments] = useState<Attachment[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [isDeleting, setIsDeleting] = useState(false);
useEffect(() => {
async function fetchNotice() {
@@ -298,16 +299,34 @@ export default function AdminNoticeDetailPage() {
<div className="flex items-center justify-end gap-[12px]">
<button
type="button"
onClick={() => {
if (confirm('정말 삭제하시겠습니까?')) {
// TODO: 삭제 API 호출
onClick={async () => {
if (!confirm('정말 삭제하시겠습니까?')) {
return;
}
if (!params?.id) {
alert('공지사항 ID를 찾을 수 없습니다.');
return;
}
try {
setIsDeleting(true);
await apiService.deleteNotice(params.id);
alert('공지사항이 삭제되었습니다.');
router.push('/admin/notices');
} catch (err) {
console.error('공지사항 삭제 오류:', err);
const errorMessage = err instanceof Error ? err.message : '공지사항 삭제에 실패했습니다.';
alert(errorMessage);
} finally {
setIsDeleting(false);
}
}}
className="bg-[#FEF2F2] h-[48px] rounded-[10px] px-[8px] shrink-0 min-w-[80px] flex items-center justify-center hover:bg-[#FEE2E2] transition-colors"
disabled={isDeleting}
className="bg-[#FEF2F2] h-[48px] rounded-[10px] px-[8px] shrink-0 min-w-[80px] flex items-center justify-center hover:bg-[#FEE2E2] transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
>
<span className="text-[16px] font-semibold leading-[1.5] text-[#F64C4C] text-center">
{isDeleting ? '삭제 중...' : '삭제'}
</span>
</button>
<button