From a73963fd0358c3b1e68cee1a90e993e2ce47bfcd Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Tue, 15 Oct 2024 15:26:53 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EB=B6=81=EB=A7=88=ED=81=AC=20=EA=B0=9C=EC=88=98=20?= =?UTF-8?q?=EB=A0=8C=EB=8D=94=EB=A7=81=20=EB=B0=8F=20=EB=B6=81=EB=A7=88?= =?UTF-8?q?=ED=81=AC=20=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20=EB=86=92?= =?UTF-8?q?=EC=9D=B4=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/mypage/MypageHeader.tsx | 16 ++++++++++++++-- src/components/product/Bookmark.tsx | 6 ++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/mypage/MypageHeader.tsx b/src/components/mypage/MypageHeader.tsx index 471acd1..5176e4d 100644 --- a/src/components/mypage/MypageHeader.tsx +++ b/src/components/mypage/MypageHeader.tsx @@ -1,11 +1,23 @@ +import { axiosInstance } from '@/service/axiosInstance'; import { useMemberStore } from '@/store/user.store'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import React from 'react'; +import { useQuery } from '@tanstack/react-query'; const MypageHeader = () => { const { member } = useMemberStore(); const router = useRouter(); + + const fetchBookmarks = async () => { + const { data } = await axiosInstance.get('https://api.moaguide.com/user/bookmark'); + return data; + }; + + const { + data: bookmarks, + } = useQuery({ queryKey: ['bookmarks'], queryFn: fetchBookmarks }); + return (
@@ -29,10 +41,10 @@ const MypageHeader = () => {
-
24개
+
{bookmarks}개
diff --git a/src/components/product/Bookmark.tsx b/src/components/product/Bookmark.tsx index 398d860..838725a 100644 --- a/src/components/product/Bookmark.tsx +++ b/src/components/product/Bookmark.tsx @@ -53,8 +53,9 @@ const Bookmark = ({ content, totalPages, pageNumber }: IProductBuildingProps) => if (isLoading) return
Loading...
; if (error) return
Error loading bookmarks
; return ( -
+
+
관심종목{' '} - {bookmarks} + {bookmarks}
totalPages={totalPages} pageNumber={pageNumber} /> +
);