-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: 마이리스트, 콜라보리스트 페이지 전체 리스트 조회 무한스크롤 구현 (#24)
* Refactor: 리스트 목록조회 react-query를 사용한 코드로 구현 * Feat: 스크롤 감지 observer api 커스텀 훅 구현 * Feat: 리스트 전체 목록조회 무한스크롤 기능 구현 * Feat: 무한스크롤 기능 수정 - 카테고리 클릭시 무한스크롤 적용된 쿼리 reset - useMemo를 사용한 MasonryGrid data 추출 * Feat: 쿼리스트링 개선, cursorId 타입 수정 * Design: 스타일 색상 공통 색상 변수로 변경 * Design: 카드 아이템 제목 길이 줄임 표시 UI 수정 * Feat: 컴포넌트 unmount 시 쿼리 캐시 제거 로직 추가 및 카테고리 클릭시 resetQuries 파라미터 수정 * Style: 주석 정리
- Loading branch information
1 parent
50cc2d2
commit 62b0c01
Showing
10 changed files
with
140 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
import axiosInstance from '@/lib/axios/axiosInstance'; | ||
import { AllListType } from '@/lib/types/listType'; | ||
|
||
export async function getAllList(userId: number, type: string, category?: string) { | ||
const query = `${category ? `${category}` : 'entire'}`; | ||
export async function getAllList(userId: number, type: string, category: string, cursorId?: number) { | ||
const params = new URLSearchParams({ | ||
type, | ||
category, | ||
size: '5', | ||
}); | ||
|
||
const response = await axiosInstance.get<AllListType>( | ||
`/users/${userId}/lists?type=${type}&category=${query}&size=10` | ||
); | ||
if (cursorId) { | ||
params.append('cursorId', cursorId.toString()); | ||
} | ||
|
||
const response = await axiosInstance.get<AllListType>(`/users/${userId}/lists?${params.toString()}`); | ||
|
||
return response.data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
import { vars } from '@/styles/theme.css'; | ||
|
||
export const button = style({ | ||
padding: '0.8rem 1.2rem', | ||
|
||
backgroundColor: 'var(--Blue, #0047FF)', | ||
backgroundColor: vars.color.blue, | ||
borderRadius: '5rem', | ||
|
||
fontSize: '1rem', | ||
fontWeight: '600', | ||
color: '#fff', | ||
color: vars.color.white, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.