diff --git a/apps/jurumarble/src/app/stamp/components/DrinkStampContainer.tsx b/apps/jurumarble/src/app/stamp/components/DrinkStampContainer.tsx index 2c8f47d3..6d81cc39 100644 --- a/apps/jurumarble/src/app/stamp/components/DrinkStampContainer.tsx +++ b/apps/jurumarble/src/app/stamp/components/DrinkStampContainer.tsx @@ -15,7 +15,7 @@ function DrinkStampContainer() { setRegionOption(value); }; - const { drinkList, subscribe, numberOfStampedDrinks } = useDrinkStampService({ + const { drinkList, subscribe, enjoyedDrinkCount } = useDrinkStampService({ page: 0, size: 10, region: regionOption, @@ -23,9 +23,7 @@ function DrinkStampContainer() { return ( <> - +

우리술 도장을
- {numberOfStampedDrinks}개 모았어요. + {enjoyedDrinkCount}개 모았어요.

diff --git a/apps/jurumarble/src/app/stamp/service/useDrinkStampListService.ts b/apps/jurumarble/src/app/stamp/service/useDrinkStampListService.ts index 11018a63..972c107f 100644 --- a/apps/jurumarble/src/app/stamp/service/useDrinkStampListService.ts +++ b/apps/jurumarble/src/app/stamp/service/useDrinkStampListService.ts @@ -22,7 +22,8 @@ export default function useDrinkStampListService(params: DrinkStampListProps) { page: pageParam?.page || params.page, }), { - getNextPageParam: ({ last, number }) => { + getNextPageParam: ({ drinkData }) => { + const { last, number } = drinkData; if (last) { return undefined; } @@ -34,11 +35,11 @@ export default function useDrinkStampListService(params: DrinkStampListProps) { }, ); - const numberOfStampedDrinks = data?.pages[0].numberOfElements ?? 0; + const enjoyedDrinkCount = data?.pages[0].enjoyedDrinkCount ?? 0; - const drinkList = data?.pages.flatMap((page) => page.content) ?? []; + const drinkList = data?.pages.flatMap((page) => page.drinkData.content) ?? []; const [subscribe] = useInfiniteScroll(fetchNextPage); - return { drinkList, fetchNextPage, subscribe, numberOfStampedDrinks }; + return { drinkList, fetchNextPage, subscribe, enjoyedDrinkCount }; } diff --git a/apps/jurumarble/src/app/vote/[id]/update/hook/useUpdataVoteForm.ts b/apps/jurumarble/src/app/vote/[id]/update/hook/useUpdataVoteForm.ts index 9b83caab..ea01c055 100644 --- a/apps/jurumarble/src/app/vote/[id]/update/hook/useUpdataVoteForm.ts +++ b/apps/jurumarble/src/app/vote/[id]/update/hook/useUpdataVoteForm.ts @@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react'; import { useMutation, useQueryClient } from '@tanstack/react-query'; import Path from 'lib/Path'; import { modifyDrinkVoteAPI, modifyNormalVoteAPI } from 'lib/apis/vote'; -import { queryKeys } from 'lib/queryKeys'; +import { queryKeys, reactQueryKeys } from 'lib/queryKeys'; import { useParams, useRouter } from 'next/navigation'; import { DrinkInfoType } from 'src/types/drink'; import { PostVoteType } from 'src/types/vote'; @@ -27,7 +27,8 @@ export default function useUpdateVoteForm() { const queryClient = useQueryClient(); const params = useParams(); - const { data } = useVoteLoadService(Number(params.id)); + const voteId = Number(params.id); + const { data } = useVoteLoadService(voteId); const [postVoteInfo, setPostVoteInfo] = useState({ detail: '', @@ -89,6 +90,7 @@ export default function useUpdateVoteForm() { onSuccess: () => { queryClient.invalidateQueries([queryKeys.VOTE_LIST]); queryClient.invalidateQueries(getMyCreatedVoteQueryKey); + queryClient.invalidateQueries(reactQueryKeys.voteDetail(voteId)); router.push(Path.VOTE_HOME); }, }, @@ -111,14 +113,14 @@ export default function useUpdateVoteForm() { title, titleA, titleB, - voteId: Number(params.id), + voteId: voteId, }) : mutateDrinkVote({ title, detail, drinkAId, drinkBId, - voteId: Number(params.id), + voteId: voteId, }); }; diff --git a/apps/jurumarble/src/lib/apis/drink.ts b/apps/jurumarble/src/lib/apis/drink.ts index 328c6af1..45b751e8 100644 --- a/apps/jurumarble/src/lib/apis/drink.ts +++ b/apps/jurumarble/src/lib/apis/drink.ts @@ -42,7 +42,12 @@ interface GetEnjoyedDrinkListRequest { region?: string; } -export interface GetEnjoyedDrinkListResponse extends DrinkListResponse {} +interface DrinkData extends DrinkListResponse {} + +interface GetEnjoyedDrinkListResponse { + drinkData: DrinkData; + enjoyedDrinkCount: number; +} export const getEnjoyedDrinkList = async ( params: GetEnjoyedDrinkListRequest,