From a299143e0091687ab26391eaa1e68734fbc59061 Mon Sep 17 00:00:00 2001 From: dvp-tae Date: Tue, 10 Dec 2024 14:31:08 +0900 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20localstorage=20any=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=9D=B4=EC=8A=88=20=ED=83=80=EC=9E=84=20=EB=8B=A8?= =?UTF-8?q?=EC=96=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/audit/auditPatch/hook/useAuditPatch.ts | 2 +- src/pages/lost-article/patch/hook/useLostPatch.ts | 2 +- .../partnershipPatch/hook/usePartnershipPatch.ts | 2 +- .../containers/PostPetitionDetailPostSection.tsx | 4 ++-- .../containers/PetitionNoticeEditorSection.tsx | 14 +++++++------- src/types/apis/get/index.tsx | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pages/audit/auditPatch/hook/useAuditPatch.ts b/src/pages/audit/auditPatch/hook/useAuditPatch.ts index cb45a250..6d8a2959 100644 --- a/src/pages/audit/auditPatch/hook/useAuditPatch.ts +++ b/src/pages/audit/auditPatch/hook/useAuditPatch.ts @@ -25,7 +25,7 @@ export function useAuditPatch() { const [thumbnailImage, setThumbnailImage] = useState(imageList[0] ?? ''); const [title, setTitle] = useState(postDetail?.title ?? ''); - const [category, setCategory] = useState(postDetail?.categoryName ?? ''); + const [category, setCategory] = useState(postDetail?.category ?? ''); const [content, setContent] = useState(postDetail?.content ?? ''); const [deletedFiles, setDeletedFiles] = useState([]); const [newFiles, setNewFiles] = useState([]); diff --git a/src/pages/lost-article/patch/hook/useLostPatch.ts b/src/pages/lost-article/patch/hook/useLostPatch.ts index eb19620d..450344d1 100644 --- a/src/pages/lost-article/patch/hook/useLostPatch.ts +++ b/src/pages/lost-article/patch/hook/useLostPatch.ts @@ -13,7 +13,7 @@ export function useLostPatch() { const postDetail = resp?.data.postDetailResDto; const [title, setTitle] = useState(postDetail?.title ?? ''); - const [category, setCategory] = useState(postDetail?.categoryName ?? ''); + const [category, setCategory] = useState(postDetail?.category ?? ''); const [content, setContent] = useState(postDetail?.content ?? ''); const imageList = postDetail?.fileResponseList?.filter((file) => file.fileType === 'images').map((file) => file.fileUrl) || []; diff --git a/src/pages/partnership/partnershipPatch/hook/usePartnershipPatch.ts b/src/pages/partnership/partnershipPatch/hook/usePartnershipPatch.ts index 845de5b6..c1b2871d 100644 --- a/src/pages/partnership/partnershipPatch/hook/usePartnershipPatch.ts +++ b/src/pages/partnership/partnershipPatch/hook/usePartnershipPatch.ts @@ -26,7 +26,7 @@ export function usePartnershipPatch() { const [thumbnailImage, setThumbnailImage] = useState(imageList[0] ?? ''); const [title, setTitle] = useState(postDetail?.title ?? ''); - const [category, setCategory] = useState(postDetail?.categoryName ?? ''); + const [category, setCategory] = useState(postDetail?.category ?? ''); const [content, setContent] = useState(postDetail?.content ?? ''); const [deletedFiles, setDeletedFiles] = useState([]); const [newFiles, setNewFiles] = useState([]); diff --git a/src/pages/petition-notice/[id]/containers/PostPetitionDetailPostSection.tsx b/src/pages/petition-notice/[id]/containers/PostPetitionDetailPostSection.tsx index b4f4b5e2..12e596bb 100644 --- a/src/pages/petition-notice/[id]/containers/PostPetitionDetailPostSection.tsx +++ b/src/pages/petition-notice/[id]/containers/PostPetitionDetailPostSection.tsx @@ -164,7 +164,7 @@ export function PostPetitionDetailPostSection() {
- +
diff --git a/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx b/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx index 16ec5757..60d01222 100644 --- a/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx +++ b/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx @@ -14,7 +14,7 @@ import { usePostBoardPosts } from '@/hooks/api/post/usePostBoardPosts'; import { GUIDE_LINE } from '../components/GuideLine'; import { useDelBoardFiles } from '@/hooks/api/del/useDelBoardFiles'; import { HookMap } from '@toast-ui/editor'; - +import { GetBoardDetailResponse } from '@/types/apis/get'; export function PetitionNoticeEditorSection() { const titleRef = useRef(null); @@ -28,19 +28,19 @@ export function PetitionNoticeEditorSection() { const navigate = useNavigate(); const oldContent = localStorage.getItem('oldContent')!; - const parsedContent = JSON.parse(oldContent); + const parsedContent = JSON.parse(oldContent) as GetBoardDetailResponse; useEffect(() => { if (parsedContent) { - const postDetailResDto = parsedContent.postDetailResDto; + const postDetailResDto = parsedContent.data.postDetailResDto; setInitialTitle(postDetailResDto.title); setInitialContent(JSON.parse(postDetailResDto.content)); - setInitialCategoryName(postDetailResDto.categoryName); + setInitialCategoryName(postDetailResDto.category); setIsEditing(true); } setLoading(false); - }, []); + }, [parsedContent]); const handleTitleChange = (e: React.ChangeEvent) => { if (e.target.value.length <= 50) { @@ -115,7 +115,7 @@ export function PetitionNoticeEditorSection() { const postFileList = imageId ? imageId : []; const patch_posts = { boardCode: '청원게시판', - postId: Number(parsedContent.postDetailResDto.postId), + postId: Number(parsedContent.data.postDetailResDto.postId), posts: { title: title, content: JSON.stringify(content), @@ -128,7 +128,7 @@ export function PetitionNoticeEditorSection() { try { const check = window.confirm('편집하시겠습니까?'); if (check) { - const old_c = parsedContent.postDetailResDto.content; + const old_c = parsedContent.data.postDetailResDto.content; const new_c = patch_posts.posts.content; const removedImg = compareImgTags(JSON.parse(old_c), JSON.parse(new_c)); diff --git a/src/types/apis/get/index.tsx b/src/types/apis/get/index.tsx index be942f46..71bb6a12 100644 --- a/src/types/apis/get/index.tsx +++ b/src/types/apis/get/index.tsx @@ -39,7 +39,7 @@ export interface FileResponse { export interface PostDetailResDto { postId: number; - categoryName: string; + category: string; authorName: string; allowedAuthorities: string[]; title: string; From e413a1b3393ca7fa205d35e087cfd0195e12821a Mon Sep 17 00:00:00 2001 From: EATSTEAK Date: Tue, 10 Dec 2024 23:21:50 +0900 Subject: [PATCH 2/6] =?UTF-8?q?fix(human-rights/edit):=20=EC=A0=9C?= =?UTF-8?q?=EB=AA=A9=EC=9D=B4=2050=EC=9E=90=20=EC=9D=B4=EC=83=81=EC=9D=BC?= =?UTF-8?q?=20=EC=8B=9C=20=EC=98=A4=EB=A5=98=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/human-rights/edit/page.tsx | 2 +- src/pages/human-rights/schema.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/human-rights/edit/page.tsx b/src/pages/human-rights/edit/page.tsx index a6991149..9b4059ea 100644 --- a/src/pages/human-rights/edit/page.tsx +++ b/src/pages/human-rights/edit/page.tsx @@ -490,7 +490,7 @@ export function HumanRightsEditPage() { titleError ? 'h-5 translate-y-0 opacity-100' : 'h-0 -translate-y-2 opacity-0' )} > - 이 값은 필수입니다. + {titleError && titleError.type === 'too_big' ? '제목은 50자 이내이여야 합니다.' : '이 값은 필수입니다.'}

Date: Wed, 11 Dec 2024 11:46:39 +0900 Subject: [PATCH 3/6] Update src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx Co-authored-by: Hyomin Koo --- .../edit/containers/PetitionNoticeEditorSection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx b/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx index 60d01222..e2c36129 100644 --- a/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx +++ b/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx @@ -28,7 +28,7 @@ export function PetitionNoticeEditorSection() { const navigate = useNavigate(); const oldContent = localStorage.getItem('oldContent')!; - const parsedContent = JSON.parse(oldContent) as GetBoardDetailResponse; + const parsedContent = JSON.parse(oldContent) as GetBoardDetailResponse['data']; useEffect(() => { if (parsedContent) { From b7cc539f7a73a04440443f7375f159bf70054635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=B1=ED=83=9C=ED=98=84?= <109207415+dvp-tae@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:46:55 +0900 Subject: [PATCH 4/6] Update src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx Co-authored-by: Hyomin Koo --- .../edit/containers/PetitionNoticeEditorSection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx b/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx index e2c36129..345405f7 100644 --- a/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx +++ b/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx @@ -115,7 +115,7 @@ export function PetitionNoticeEditorSection() { const postFileList = imageId ? imageId : []; const patch_posts = { boardCode: '청원게시판', - postId: Number(parsedContent.data.postDetailResDto.postId), + postId: Number(parsedContent.postDetailResDto.postId), posts: { title: title, content: JSON.stringify(content), From ef7e44c28de0c6012561e121d82fea621594594a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=B1=ED=83=9C=ED=98=84?= <109207415+dvp-tae@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:47:01 +0900 Subject: [PATCH 5/6] Update src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx Co-authored-by: Hyomin Koo --- .../edit/containers/PetitionNoticeEditorSection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx b/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx index 345405f7..4a6dcb9a 100644 --- a/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx +++ b/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx @@ -32,7 +32,7 @@ export function PetitionNoticeEditorSection() { useEffect(() => { if (parsedContent) { - const postDetailResDto = parsedContent.data.postDetailResDto; + const postDetailResDto = parsedContent.postDetailResDto; setInitialTitle(postDetailResDto.title); setInitialContent(JSON.parse(postDetailResDto.content)); setInitialCategoryName(postDetailResDto.category); From 026255e8146e2bfa4feefe19c488508a0467a870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=B1=ED=83=9C=ED=98=84?= <109207415+dvp-tae@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:47:14 +0900 Subject: [PATCH 6/6] Update src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx Co-authored-by: Hyomin Koo --- .../edit/containers/PetitionNoticeEditorSection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx b/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx index 4a6dcb9a..f71a9da6 100644 --- a/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx +++ b/src/pages/petition-notice/edit/containers/PetitionNoticeEditorSection.tsx @@ -128,7 +128,7 @@ export function PetitionNoticeEditorSection() { try { const check = window.confirm('편집하시겠습니까?'); if (check) { - const old_c = parsedContent.data.postDetailResDto.content; + const old_c = parsedContent.postDetailResDto.content; const new_c = patch_posts.posts.content; const removedImg = compareImgTags(JSON.parse(old_c), JSON.parse(new_c));