불러오는 중...
;
- if (isError || !data) return 와인 데이터를 불러올 수 없습니다.
;
-
-
- /* 전체 와인 리스트 조합 */
- const wineList = data.pages.flatMap((page) => page.list);
-
return (
- {wineList.map((wine) => (
+ {filteredWines.map((wine) => (
))}
- {/* 무한 스크롤 감지 */}
-
);
}
diff --git a/src/hooks/useWineListQuery.ts b/src/hooks/useWineListQuery.ts
index 9809f8b..529d42a 100644
--- a/src/hooks/useWineListQuery.ts
+++ b/src/hooks/useWineListQuery.ts
@@ -7,7 +7,6 @@ import useWineSearchKeywordStore from '@/stores/searchStore';
const PAGE_LIMIT = 8;
export function useWineListQuery() {
- /* 각 필터 상태 */
const type = useFilterStore((state) => state.type);
const minPrice = useFilterStore((state) => state.minPrice);
const maxPrice = useFilterStore((state) => state.maxPrice);
diff --git a/src/lib/getWines.ts b/src/lib/getWines.ts
index 630fc35..5dcc030 100644
--- a/src/lib/getWines.ts
+++ b/src/lib/getWines.ts
@@ -1,4 +1,4 @@
-import useWineAddStore, { Wine } from '@/stores/wineAddStore';
+import useWinAddStore, { Wine } from '@/stores/wineAddStore';
interface GetWinesParams {
cursor: number;
@@ -18,7 +18,6 @@ interface GetWinesResponse {
totalCount: number;
}
-/* 평점 필터링 */
const ratingRangeMap: Record
= {
all: [0, 5],
'4.6': [4.5, 5],
@@ -27,9 +26,9 @@ const ratingRangeMap: Record = {
'3.1': [3.0, 3.5],
};
-/* 필터링 + 페이징 */
export function getWines({ cursor, limit, filters }: GetWinesParams): GetWinesResponse {
- const allWines = useWineAddStore.getState().wines;
+ // zustand에서 mock 데이터 직접 가져옴
+ const allWines = useWinAddStore.getState().wines;
const { type, minPrice = 0, maxPrice = Infinity, rating = 'all', searchTerm = '' } = filters;
diff --git a/src/stores/wineAddStore.ts b/src/stores/wineAddStore.ts
index 108f832..5bcf621 100644
--- a/src/stores/wineAddStore.ts
+++ b/src/stores/wineAddStore.ts
@@ -16,7 +16,7 @@ interface WineStoreState {
addWine: (newWine: Wine) => void;
}
-const useWineAddStore = create((set) => ({
+const useWinAddStore = create((set) => ({
wines: [
{
id: 1,
@@ -36,188 +36,12 @@ const useWineAddStore = create((set) => ({
image: '/images/image3.svg',
price: 64900,
rating: 4.6,
- type: 'Sparkling',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 3,
- name: 'Sentinel Carbernet Sauvignon 2016',
- region: 'Western Cape, South Africa',
- image: '/images/image2.svg',
- price: 59900,
- rating: 3.6,
type: 'White',
review:
'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
},
{
- id: 4,
- name: 'Palazzo della Torre 2017',
- region: 'Western Cape, South Africa',
- image: '/images/image4.svg',
- price: 74000,
- rating: 2.1,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 5,
- name: 'Sentinel Carbernet Sauvignon 2016',
- region: 'Western Cape, South Africa',
- image: '/images/image1.svg',
- price: 64900,
- rating: 4.5,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 6,
- name: 'Palazzo della Torre 2017',
- region: 'Western Cape, South Africa',
- image: '/images/image3.svg',
- price: 64900,
- rating: 4.6,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 7,
- name: 'Sentinel Carbernet Sauvignon 2016',
- region: 'Western Cape, South Africa',
- image: '/images/image2.svg',
- price: 59900,
- rating: 3.6,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 8,
- name: 'Palazzo della Torre 2017',
- region: 'Western Cape, South Africa',
- image: '/images/image4.svg',
- price: 74000,
- rating: 2.1,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 9,
- name: 'Sentinel Carbernet Sauvignon 2016',
- region: 'Western Cape, South Africa',
- image: '/images/image1.svg',
- price: 64900,
- rating: 4.5,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 10,
- name: 'Palazzo della Torre 2017',
- region: 'Western Cape, South Africa',
- image: '/images/image3.svg',
- price: 64900,
- rating: 4.6,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 11,
- name: 'Sentinel Carbernet Sauvignon 2016',
- region: 'Western Cape, South Africa',
- image: '/images/image2.svg',
- price: 59900,
- rating: 3.6,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 12,
- name: 'Palazzo della Torre 2017',
- region: 'Western Cape, South Africa',
- image: '/images/image4.svg',
- price: 74000,
- rating: 2.1,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 13,
- name: 'Sentinel Carbernet Sauvignon 2016',
- region: 'Western Cape, South Africa',
- image: '/images/image1.svg',
- price: 64900,
- rating: 4.5,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 14,
- name: 'Palazzo della Torre 2017',
- region: 'Western Cape, South Africa',
- image: '/images/image3.svg',
- price: 64900,
- rating: 4.6,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 15,
- name: 'Sentinel Carbernet Sauvignon 2016',
- region: 'Western Cape, South Africa',
- image: '/images/image2.svg',
- price: 59900,
- rating: 3.6,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 16,
- name: 'Palazzo della Torre 2017',
- region: 'Western Cape, South Africa',
- image: '/images/image4.svg',
- price: 74000,
- rating: 2.1,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 17,
- name: 'Sentinel Carbernet Sauvignon 2016',
- region: 'Western Cape, South Africa',
- image: '/images/image1.svg',
- price: 64900,
- rating: 4.5,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 18,
- name: 'Palazzo della Torre 2017',
- region: 'Western Cape, South Africa',
- image: '/images/image3.svg',
- price: 64900,
- rating: 4.6,
- type: 'Red',
- review:
- 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
- },
- {
- id: 19,
+ id: 3,
name: 'Sentinel Carbernet Sauvignon 2016',
region: 'Western Cape, South Africa',
image: '/images/image2.svg',
@@ -228,13 +52,13 @@ const useWineAddStore = create((set) => ({
'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
},
{
- id: 20,
+ id: 4,
name: 'Palazzo della Torre 2017',
region: 'Western Cape, South Africa',
image: '/images/image4.svg',
price: 74000,
rating: 2.1,
- type: 'Red',
+ type: 'Sparkling',
review:
'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
},
@@ -246,4 +70,4 @@ const useWineAddStore = create((set) => ({
})),
}));
-export default useWineAddStore;
+export default useWinAddStore;