From 5d2502b1fdbc7abc9e74ce1480a052e358942fb8 Mon Sep 17 00:00:00 2001 From: choiseona Date: Tue, 9 Jul 2024 16:59:14 +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=EC=98=A8=EB=8F=84=20=EB=8F=99=EC=A0=81=20=EC=8A=A4?= =?UTF-8?q?=ED=83=80=EC=9D=BC=EB=A7=81=20=EB=B2=84=EA=B7=B8=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to: #408 --- .../MyPage/MyPage/Temperature/Temperature.tsx | 8 -------- src/hooks/queries/useProfileQuery.tsx | 13 ++++++++++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/MyPage/MyPage/Temperature/Temperature.tsx b/src/components/MyPage/MyPage/Temperature/Temperature.tsx index 471b2ec9..4f556998 100644 --- a/src/components/MyPage/MyPage/Temperature/Temperature.tsx +++ b/src/components/MyPage/MyPage/Temperature/Temperature.tsx @@ -5,14 +5,6 @@ interface Props { } function Temperature({ temperature }: Props) { - temperature += 36.5; - - if (temperature <= 0) { - temperature = 0; - } else if (temperature >= 100) { - temperature = 100; - } - const temperatureColorConditions = [ { max: 10, color: "#7EC7FC" }, { max: 20, color: "#72EF86" }, diff --git a/src/hooks/queries/useProfileQuery.tsx b/src/hooks/queries/useProfileQuery.tsx index a6299ec8..1c158439 100644 --- a/src/hooks/queries/useProfileQuery.tsx +++ b/src/hooks/queries/useProfileQuery.tsx @@ -21,9 +21,20 @@ import { useMutation, useQuery } from "react-query"; import { useNavigate } from "react-router-dom"; export const useGetMyProfile = () => { + const adjustTemperature = (data: MyProfileDataType) => { + let progressBar = data.progressBar + 36.5; + if (progressBar < 0) { + progressBar = 0; + } else if (progressBar > 100) { + progressBar = 100; + } + return { ...data, progressBar }; + }; + const { data, isLoading } = useQuery({ queryKey: [QUERY_KEY.MY_PROFILE], - queryFn: () => getMyPageProfile(), + queryFn: getMyPageProfile, + select: adjustTemperature, }); return { data, isLoading };