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 };