From 7008cb08a2fae8cd9a1b5315d52ba514af910f7e Mon Sep 17 00:00:00 2001 From: sscoderati Date: Tue, 9 Jan 2024 16:32:56 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EB=AA=85=EC=83=81=20=EC=A2=85=EB=A3=8C?= =?UTF-8?q?=20=EB=B2=84=ED=8A=BC=20=ED=95=B8=EB=93=A4=EB=9F=AC=EC=97=90=20?= =?UTF-8?q?=EB=AA=85=EC=83=81=20=EA=B4=80=EB=A0=A8=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/MeditationEndButton.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/pages/meditation/components/MeditationEndButton.tsx b/src/pages/meditation/components/MeditationEndButton.tsx index 564ea1c4..63dc6811 100644 --- a/src/pages/meditation/components/MeditationEndButton.tsx +++ b/src/pages/meditation/components/MeditationEndButton.tsx @@ -2,16 +2,28 @@ import { useState } from 'react'; import { Confirm } from '@components/Confirm'; import { Button } from '@components/Button'; import { EndButtonContainer } from './MeditationEndButton.style'; +import { MeditationStatusType } from '@pages/meditation/types'; +import { intervalId, meditationTime } from '@pages/meditation/states'; +import { useRecoilState, useSetRecoilState } from 'recoil'; -const MeditationEndButton = () => { +const MeditationEndButton = ({ + statusSetter: meditationStatusSetter +}: { + statusSetter: React.Dispatch>; +}) => { const [confirmCaptured, setConfirmCaptured] = useState(false); + const setTime = useSetRecoilState(meditationTime); + const [timerId, setTimerId] = useRecoilState(intervalId); const handleCancelButton = () => { setConfirmCaptured(false); }; const handleConfirmButton = () => { - location.reload(); // 리팩토링 전 임시방편 + meditationStatusSetter({ started: false, paused: true, ended: false }); + clearInterval(timerId); + setTimerId(0); + setTime(0); }; return ( <>