Skip to content

Commit

Permalink
Merge pull request #362 from ssu-student-union/fix/#361_change-catego…
Browse files Browse the repository at this point in the history
…ryName

fix: categoryName 필드 category 필드명으로 변경
  • Loading branch information
dvp-tae authored Dec 11, 2024
2 parents 285c4e7 + 026255e commit b8a6ef4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
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} />
</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

0 comments on commit b8a6ef4

Please sign in to comment.