Repository navigation
[4주차/표표] 워크북 제출합니다. - #51
Conversation
| type MovieDetail = { | ||
| id: number; | ||
| title: string; | ||
| overview: string; | ||
| poster_path: string | null; | ||
| backdrop_path: string | null; | ||
| release_date: string; | ||
| runtime: number; | ||
| vote_average: number; | ||
| genres: { id: number; name: string }[]; | ||
| credits?: { cast: { id: number; name: string; character: string; profile_path: string | null }[] }; | ||
| }; |
There was a problem hiding this comment.
type MovieDetail = {
id: number;
title: string;
overview?: string | null;
poster_path?: string | null;
backdrop_path?: string | null;
release_date?: string;
runtime?: number | null;
vote_average?: number | null;
genres?: { id: number; name: string }[];
credits?: {
cast?: {
id: number;
name: string;
character?: string;
profile_path?: string | null;
}[];
};
};
이렇게 바꾸면 더 안전할 것 같아요!
There was a problem hiding this comment.
cast와 credits에 ? 를 주어서 아무것도 없을 수 있음을 반영해 입력에 안전하다는 뜻이군용!! 감사합니다
type MovieDetail = {
id: number;
title: string;
overview?: string | null;
poster_path?: string | null;
backdrop_path?: string | null;
release_date?: string;
runtime?: number | null;
vote_average?: number | null;
genres: { id: number; name: string }[];
credits?: {
cast?: {
id: number;
name: string;
character?: string;
profile_path?: string | null;
}[];
};
};이렇게 바꿔봤습니다!
| @@ -0,0 +1,15 @@ | |||
| import { Outlet } from 'react-router-dom'; | |||
| import { Navbar } from '../components/Navbar'; | |||
| import { useCustomFetch } from '../hooks/useCustomFetch'; | |||
There was a problem hiding this comment.
현재 페이지에서 useCustomFetch를 사용하지 않으니 경고가 뜰 수 있습니다. import 지워주세요
There was a problem hiding this comment.
import { Outlet } from 'react-router-dom';
import { Navbar } from '../components/Navbar';
const HomePage = () => {
return (
<>
<Navbar />
<Outlet />
</>
);
}
export default HomePage;지우고 경고 삭제 됐습니다!
| import { postSignup } from "../apis/auth"; // 경로는 프로젝트에 맞게 | ||
| import type { RequestSignupDto } from "../types/auth"; // { name:string; email:string; password:string } 형태라고 가정 | ||
|
|
||
| /* ---------------- Zod 전체 스키마 ---------------- */ |
There was a problem hiding this comment.
SignupPage.tsx 코드가 전체 폼 로직과 검증 로직을 모두 포함하고 있어서 파일 코드 길이가 깁니다.
가독성과 유지보수를 위해 Zod 스키마 부분을 별도의 파일(ex) src/schemas/signup.ts처럼 분리)로 분리해 관리하는 걸 추천합니다.
| [JSON.stringify(options ?? {})] | ||
| ); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
비동기 요청을 AbortController로 제어해 컴포넌트 언마운트 시 불필요한 상태 업데이트를 방지한 점이 좋습니다!
| bio:string|null; | ||
| avatar:string|null; | ||
| createdAt:Date; | ||
| updateAt:Date; |
There was a problem hiding this comment.
DTO 타입들을 별도의 파일로 분리해 관리한 점이 좋습니다.
API 요청/응답 구조를 한눈에 파악할 수 있어서 유지보수성에 좋아보입니댱
|
표표, 4주차도 수고하셨습니다! 머지해주세요~ |
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트
📌 주안점