-
Notifications
You must be signed in to change notification settings - Fork 20
[장해명] sprint9 #95
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
[장해명] sprint9 #95
The head ref may contain hidden characters: "Next-\uC7A5\uD574\uBA85-sprint9"
Conversation
[Fix] delete merged branch github action
design: Header UI 구현 및 Pretend Font 설정 및 적용
- getAllArticles API 호출 방식 axios > fetch 로 변경
- feat: dropdown handler 클릭 시 메뉴 열림 - design: dropdown 기본 UI 작성
- handleDropDownToggle 함수 인라인 작성 - 상수 > 타입 > 상태 > 라우터 > useEffect > 이벤트 핸들러로 순서 조정
- chore: svg 파일명 컨벤션 snake_case 로 변경
|
스프리트 미션 하시느라 수고 많으셨어요. |
키워드 검색 시, 데이터가 새로 페칭되기 전 화면이 잠깐 깜빡이는 현상이 발생합니다. 정확한 원인을 파악하지 못해서 함께 질문드립니다 !오잉 로컬에서 확인해본 결과 딱히 블링크 되는 현상은 없는 것 같아요.
2025-04-23.1.56.02.mov혹시 제가 놓친게 있다면 DM주세요 😊 |
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.
오호 vscode 세팅도 형상관리에 저장해두셨군요?
같은 팀원들이 같은 툴과 비슷한 환경으로 개발한다면 헙업에 도움 될 수 있지요 !
|
|
||
| type SearchParams = Promise<{ [key: string]: string | string[] | undefined }>; | ||
|
|
||
| export default async function BoardsPage({ searchParams }: { searchParams: SearchParams }) { |
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.
굿굿~ 상단 페이지 컴포넌트에서 서버사이드로 fetch를 하고 있군요 !
이러한 구조는 서버 사이드에서 fetch를 하고 하위 컴포넌트로 데이터를 내려줘서 TTV를 줄일 수 있는 좋은 패턴이예요 !
Time To View(TTV): 사용자가 웹브라우저에서 내용을 볼 수 있는 시점
기존 리액트 때: 클라이언트가 서버에 요청 -> 클라이언트에 HTML을 전달 -> 서버에 데이터 요청 -> 데이터베이스 -> ...
현재 구조: 클라이언트가 서버에 요청 -> 서버가 데이터베이스에 데이터 요청 -> 클라이언트 반환 및 렌더링
간선도 훨씬 짧아졌습니다 👍👍
| @@ -0,0 +1,128 @@ | |||
| @import 'tailwindcss'; | |||
|
|
|||
| @theme { | |||
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.
크으 새로운 라이브러리도 척척 이시군요 ! 👍👍
| export const metadata: Metadata = { | ||
| title: "Panda Market", | ||
| description: "Trading site for used goods", | ||
| }; |
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.
메타 데이터 설정도 훌륭합니다 !
layout.tsx에서 정의할 수 있지요. 추 후 boards/:id 페이지가 개발 된다면 동적인 메타 데이터도 넣어볼 수 있겠네요 😊😊
| export const getArticles = async ({ | ||
| page = 1, | ||
| pageSize = 10, | ||
| orderBy = 'recent', | ||
| keyword, | ||
| }: GetArticlesParams = {}): Promise<GetArticlesResponse> => { | ||
| // set query parameter | ||
| const params = new URLSearchParams(); | ||
| params.append('page', page.toString()); | ||
| params.append('pageSize', pageSize.toString()); | ||
| params.append('orderBy', orderBy); | ||
| if (keyword) { | ||
| params.append('keyword', keyword); | ||
| } | ||
|
|
||
| // get baseURL | ||
| const baseURL = process.env.NEXT_PUBLIC_API_URL; | ||
| const res = await fetch(`${baseURL}/articles?${params.toString()}`, { | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| next: { | ||
| revalidate: 3600, | ||
| }, | ||
| }); | ||
|
|
||
| if (!res.ok) { | ||
| throw new Error(`HTTP Error : ${res.status}`); | ||
| } | ||
|
|
||
| const data = await res.json(); | ||
| return data; | ||
| }; |
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.
오호 이 친구만 fetch를 사용해보셨군요.
nextjs의 .next를 활용해보고자 시범적으로 바꿔보신 것으로 보여요 ! 훌륭한 학습 자세예요 😊😊
테스트도 직접 해보시면서 유효한 시간 내에 서버 단에서 네트워크 요청을 안보내는지 확인도 해보시면 좋을 것 같네요 👍
| // post article | ||
| export const postArticle = async (data: ArticleBody) => { | ||
| const res = await apiClient.post<ArticleResponse>('/articles', data); | ||
| return res.data; | ||
| }; | ||
|
|
||
| // get article by id | ||
| export const getArticleById = async (articleId: number) => { | ||
| const res = await apiClient.get<ArticleResponse>(`/articles/${articleId}`); | ||
| return res.data; | ||
| }; | ||
|
|
||
| // patch article by id | ||
| export const patchArticleById = async (articleId: number, data: ArticleBody) => { | ||
| const res = await apiClient.patch<ArticleResponse>(`/articles/${articleId}`, data); | ||
| return res.data; | ||
| }; | ||
|
|
||
| // delete article by id | ||
| export const deleteArticleById = async (articleId: number) => { | ||
| const res = await apiClient.delete<DeleteArticleResponse>(`/articles/${articleId}`); | ||
| return res.data; | ||
| }; | ||
|
|
||
| // post like in article by id | ||
| export const postLikeInArticle = async (articleId: number) => { | ||
| const res = await apiClient.post<ArticleResponse>(`/articles/${articleId}/like`); | ||
| return res.data; | ||
| }; | ||
|
|
||
| // delete like in article by id | ||
| export const deleteLikeInArticle = async (articleId: number) => { | ||
| const res = await apiClient.delete<ArticleResponse>(`/articles/${articleId}/like`); | ||
| return res.data; | ||
| }; |
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.
깔-끔 합니다 👍
추가로, 만약 로깅을 해야한다면 try, catch를 해볼 수도 있겠네요 😊
|
수고하셨습니다 해명님 ! 잠시 쉬었음에도 불구하고 엄청난 속도의 학습력입니다 👍👍👍👍 과제 하시느라 정말 수고 많으셨어요 해명님 ! |
요구사항
기본
심화
스크린샷
주요 변경사항
멘토에게