+
+
+
+
+
+
+
콘텐츠 목록
+
+ {pageMenuAuthority?.regAuthrtYn === "Y" && (
+
+ )}
+ {pageMenuAuthority?.delAuthrtYn === "Y" && (
+
+ )}
+
+
+
+
+
+ e.stopPropagation()}
+ onCheckedChange={handleAllCheckboxChange}
+ />
+
+
+ {isFetched ? (
+
+ {postList?.content.map((item) => (
+
+
e.stopPropagation()}
+ onCheckedChange={(checked) =>
+ handleCheckboxChange(item.pstNo, checked)
+ }
+ className="mx-2 my-6"
+ />
+
+
+
+
+ Q
+ {item.pstTtl}
+
+
+ 등록일: {dayjs(item.regDt).format("YYYY-MM-DD")}
+
+
+
+
+
+
+ A
+
+
+
+
+
+
+
+
+
+
+ ))}
+
+ ) : (
+
+ )}
+
+
+
+ );
+}
+
+function Attachment({ atflCd }: { atflCd: string }) {
+ const [filename, setFilename] = useState("");
+
+ const { data: downloadResponse, isFetching } = useQuery({
+ queryKey: [ENDPOINT.ATTACH_SERVICE.DOWNLOAD, atflCd],
+ queryFn: () => AttachmentApi.downloadAttachmentByAtflCd(atflCd),
+ enabled: !!atflCd,
+ });
+
+ const handleDownload = async () => {
+ if (!downloadResponse) return;
+ try {
+ const blob = new Blob([downloadResponse.data]);
+ const url = window.URL.createObjectURL(blob);
+ const link = document.createElement("a");
+
+ link.href = url;
+ link.download = filename || "download";
+ document.body.appendChild(link);
+ link.click();
+
+ window.URL.revokeObjectURL(url);
+ document.body.removeChild(link);
+ } catch (error) {
+ console.error(error);
+ }
+ };
+
+ useEffect(() => {
+ if (!downloadResponse) return;
+ try {
+ let filename = "";
+ const contentDisposition =
+ downloadResponse.headers["content-disposition"];
+ if (contentDisposition) {
+ const filenameMatch = contentDisposition.match(
+ /filename\*=UTF-8''([^;]+)/,
+ );
+ if (filenameMatch && filenameMatch[1]) {
+ filename = decodeURIComponent(filenameMatch[1]);
+ }
+ }
+ setFilename(filename);
+ } catch {
+ setFilename("");
+ }
+ }, [downloadResponse]);
+
+ return isFetching ? (
+