Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix : categoryName 필드 category 필드명으로 변경 #365

Merged
merged 9 commits into from
Dec 12, 2024
2 changes: 1 addition & 1 deletion src/pages/audit/auditPatch/hook/useAuditPatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function useAuditPatch() {
const [thumbnailImage, setThumbnailImage] = useState<string>(imageList[0] ?? '');

const [title, setTitle] = useState<string>(postDetail?.title ?? '');
const [category, setCategory] = useState<string>(postDetail?.categoryName ?? '');
const [category, setCategory] = useState<string>(postDetail?.category ?? '');
const [content, setContent] = useState<string>(postDetail?.content ?? '');
const [deletedFiles, setDeletedFiles] = useState<string[]>([]);
const [newFiles, setNewFiles] = useState<File[]>([]);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/human-rights/edit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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자 이내이여야 합니다.' : '이 값은 필수입니다.'}
</p>
</div>
<Editor
Expand Down
2 changes: 1 addition & 1 deletion src/pages/human-rights/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const HumanRightsPostSummarySchema = z.object({

export const HumanRightsPostEditFormSchema = z.object({
postId: z.number().optional(),
title: z.string().min(1),
title: z.string().min(1).max(50),
category: HumanRightsCategorySchema,
isNotice: z.literal(false),
postFileList: z.array(z.number()),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/lost-article/patch/hook/useLostPatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function useLostPatch() {
const postDetail = resp?.data.postDetailResDto;

const [title, setTitle] = useState<string>(postDetail?.title ?? '');
const [category, setCategory] = useState<string>(postDetail?.categoryName ?? '');
const [category, setCategory] = useState<string>(postDetail?.category ?? '');
const [content, setContent] = useState<string>(postDetail?.content ?? '');
const imageList =
postDetail?.fileResponseList?.filter((file) => file.fileType === 'images').map((file) => file.fileUrl) || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function usePartnershipPatch() {
const [thumbnailImage, setThumbnailImage] = useState<string>(imageList[0] ?? '');

const [title, setTitle] = useState<string>(postDetail?.title ?? '');
const [category, setCategory] = useState<string>(postDetail?.categoryName ?? '');
const [category, setCategory] = useState<string>(postDetail?.category ?? '');
const [content, setContent] = useState<string>(postDetail?.content ?? '');
const [deletedFiles, setDeletedFiles] = useState<string[]>([]);
const [newFiles, setNewFiles] = useState<File[]>([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export function PostPetitionDetailPostSection() {
<div className="mb-[25px] mt-[182px] px-[200px] xs:px-[35px] sm:px-[35px] md:px-[70px] lg:px-[70px]">
<Breadcrumb items={breadcrumbItems} />
<PostHead
title={`[${data?.data.postDetailResDto.categoryName}] ${data?.data.postDetailResDto.title}`}
title={`[${data?.data.postDetailResDto.category}] ${data?.data.postDetailResDto.title}`}
writer={
data?.data.postDetailResDto.studentId === null
? data.data.postDetailResDto.authorName
Expand All @@ -190,7 +190,7 @@ export function PostPetitionDetailPostSection() {
</div>
</div>
<div className="xs:hidden sm:hidden md:hidden">
<StateTag current={data?.data.postDetailResDto.categoryName || null} />
<StateTag current={data?.data.postDetailResDto.category || null} />
</div>
</div>
<div className="mt-[60px] flex-col">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLInputElement>(null);
Expand All @@ -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['data'];

useEffect(() => {
if (parsedContent) {
const postDetailResDto = parsedContent.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<HTMLInputElement>) => {
if (e.target.value.length <= 50) {
Expand Down
2 changes: 1 addition & 1 deletion src/types/apis/get/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface FileResponse {

export interface PostDetailResDto {
postId: number;
categoryName: string;
category: string;
authorName: string;
allowedAuthorities: string[];
title: string;
Expand Down