Skip to content

Commit fea727b

Browse files
committed
Fix allow updates when any option changes
1 parent 8f42482 commit fea727b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

+12-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,18 @@ const WhitebookUpdateModal = ({ trigger, whitebook }) => {
4646
} else if (inputType === 'pdf' && pdfFile) {
4747
formData.append('pdf_file', pdfFile);
4848
} else {
49-
alert('링크 또는 PDF 파일을 입력해주세요.');
50-
return;
49+
// title, content, show_only_login 중 하나라도 변경되었다면 수정 가능
50+
if (
51+
title !== whitebook.title ||
52+
content !== whitebook.cotent ||
53+
showOnlyLogin !== whitebook.show_only_login
54+
) {
55+
const link = inputType === 'link' ? link : uploadedPDFLink;
56+
formData.append('link', link);
57+
} else {
58+
alert('링크 또는 PDF 파일을 입력해주세요.');
59+
return;
60+
}
5161
}
5262

5363
await PoPoAxios.put(`/whitebook/${whitebook.uuid}`, formData, {

0 commit comments

Comments
 (0)