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

fix: categoryName 필드 category 필드명으로 변경 #362

Merged
merged 5 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/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} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아이고 다 고쳐주시다니 고생하셨습니다

</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