Skip to content

Commit 8f42482

Browse files
committed
Delete pdf fetching logic
1 parent b3af72b commit 8f42482

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

components/board/whitebook/whitebook.create.modal.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const WhitebookCreateModal = (props) => {
124124
textDecoration: 'underline',
125125
}}
126126
>
127-
업로드한 PDF 확인
127+
{pdfFile.name}
128128
</a>
129129
)}
130130
</label>

components/board/whitebook/whitebook.update.modal.jsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const WhitebookUpdateModal = ({ trigger, whitebook }) => {
1212
const [showOnlyLogin, setShowOnlyLogin] = useState(whitebook.show_only_login);
1313
const [inputType, setInputType] = useState(whitebook.link ? 'link' : 'pdf');
1414
const [link, setLink] = useState(whitebook.link || '');
15+
const [uploadedPDFLink, setUploadedPDFLink] = useState(null);
1516
const [pdfFile, setPdfFile] = useState(null);
1617

1718
const handleModalOpen = () => {
@@ -20,11 +21,8 @@ const WhitebookUpdateModal = ({ trigger, whitebook }) => {
2021
if (whitebook.link && whitebook.link.includes('whitebook')) {
2122
const link = whitebook.link;
2223
setLink('');
24+
setUploadedPDFLink(link);
2325
setInputType('pdf');
24-
fetch(link)
25-
.then((res) => res.blob())
26-
.then((blob) => setPdfFile(blob))
27-
.catch((err) => console.error(err));
2826
}
2927
};
3028

@@ -133,16 +131,18 @@ const WhitebookUpdateModal = ({ trigger, whitebook }) => {
133131
onChange={(e) => handleFileChange(e.target.files[0])}
134132
/>
135133
<label>
136-
{pdfFile && (
134+
{(pdfFile || uploadedPDFLink) && (
137135
<a
138-
href={URL.createObjectURL(pdfFile)}
136+
href={
137+
pdfFile ? URL.createObjectURL(pdfFile) : uploadedPDFLink
138+
}
139139
target="_blank"
140140
rel="noopener noreferrer"
141141
style={{
142142
textDecoration: 'underline',
143143
}}
144144
>
145-
업로드한 PDF 확인
145+
{pdfFile ? pdfFile.name : '기존 PDF 확인'}
146146
</a>
147147
)}
148148
</label>

0 commit comments

Comments
 (0)