-
Notifications
You must be signed in to change notification settings - Fork 0
Create Week3 Mission1, 2, 3 #51
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
Conversation
hyesngy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
κ³ μ λ§μΌμ
¨μ΅λλ€!ππ
μ΄λ² μ£Ό μν¬λΆμ ν΅ν΄ useEffect, API μ°λ, λΌμ°ν
κ³Ό μν κ΄λ¦¬κΉμ§ κ²½νν΄λ³΄μ
¨λ€μ!
κ³μν΄μ μ€μ΅κ³Ό νμ΅μ λ³ννλ©° μ€λ ₯μ μμκ°μκΈΈ μμν©λλ€!!ππ
| interface Movie { | ||
| title?: string; | ||
| original_title?: string; | ||
| release_date?: string; | ||
| vote_average?: number; | ||
| runtime?: number; | ||
| tagline?: string; | ||
| overview?: string; | ||
| poster_path?: string; | ||
| } | ||
|
|
||
| interface Person { | ||
| name: string; | ||
| original_name: string; | ||
| profile_path: string; | ||
| } | ||
|
|
||
| interface Props { | ||
| movie: Movie; | ||
| directorInfo?: Person; | ||
| mainCast: Person[]; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Movie, Person, Props μΈν°νμ΄μ€κ° νμ¬ λ€λ₯Έ νμΌμμλ μ¬μ©λκ³ μλλ°, types ν΄λλ‘ λΆλ¦¬νλ©΄ μ¬μ¬μ©μ± μΈ‘λ©΄μμλ μ’κ³ κ°λ μ±λ λ μ’μμ§ κ² κ°μ΅λλ€!
| const fetchMovieDetails = async (movieId: string): Promise<Movie> => { | ||
| const response = await fetch( | ||
| `https://api.themoviedb.org/3/movie/${movieId}?language=ko-KR`, | ||
| { | ||
| headers: { | ||
| Authorization: `Bearer ${import.meta.env.VITE_API_KEY}`, | ||
| }, | ||
| } | ||
| ); | ||
| if (!response.ok) { | ||
| throw new Error("μν μμΈ μ 보λ₯Ό κ°μ Έμ€λ λ° μ€ν¨νμ΅λλ€."); | ||
| } | ||
| return response.json(); | ||
| }; | ||
|
|
||
| const fetchCredits = async (movieId: string): Promise<Credits> => { | ||
| const response = await fetch( | ||
| `https://api.themoviedb.org/3/movie/${movieId}/credits?language=ko-KR`, | ||
| { | ||
| headers: { | ||
| Authorization: `Bearer ${import.meta.env.VITE_API_KEY}`, | ||
| }, | ||
| } | ||
| ); | ||
| if (!response.ok) { | ||
| throw new Error("μν ν¬λ λ§ μ 보λ₯Ό κ°μ Έμ€λ λ° μ€ν¨νμ΅λλ€."); | ||
| } | ||
| return response.json(); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ΄ API νΈμΆ ν¨μ λΆλΆμ λ°λ‘ λΆλ¦¬νλ©΄ νλ‘μ νΈ κ΅¬μ‘°κ° λͺ νν΄μ§κ³ κ°λ μ±λ μ’μμ§ κ² κ°μμ!
hyesngy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
νμ¬ 2μ£Όμ°¨ λ―Έμ ν΄λμ .vite/deps ν΄λ νμΌμ΄ μ¬λΌμμλλ° μ κ±° λΆνλ립λλ€!
π λ―Έμ λ²νΈ
3μ£Όμ°¨ Misson 1,2,3
π ꡬν μ¬ν
π μ€ν¬λ¦°μ·
β 체ν¬λ¦¬μ€νΈ
π€ μ§λ¬Έ μ¬ν