From 7a23e08120b03e80be22f625766986c13923ca4d Mon Sep 17 00:00:00 2001 From: G-hoon Date: Wed, 25 Sep 2024 15:27:09 +0900 Subject: [PATCH] =?UTF-8?q?[feat/#58]=20=EC=B4=88=EA=B8=B0=20=EC=95=8C?= =?UTF-8?q?=EB=9E=8C=EA=B0=92=EC=9D=B4=20=EC=97=86=EC=9D=84=20=EB=95=8C,?= =?UTF-8?q?=20=EC=95=8C=EB=A6=BC=20=EC=BC=9C=EA=B8=B0=20=EB=B2=84=ED=8A=BC?= =?UTF-8?q?=EC=9D=B4=20ON=20=EC=9D=B4=20=EC=95=88=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=EC=9D=B4=EC=8A=88=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Posture/PostrueCrew.tsx | 28 +++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/components/Posture/PostrueCrew.tsx b/src/components/Posture/PostrueCrew.tsx index 397aef4..28f40bc 100644 --- a/src/components/Posture/PostrueCrew.tsx +++ b/src/components/Posture/PostrueCrew.tsx @@ -148,15 +148,25 @@ export default function PostrueCrew(props: PostureCrewProps): ReactElement { } const onClickNotiAlarm = (): void => { - updateNotiMutation.mutate( - { isActive: !notification?.isActive, duration: notification?.duration }, - { - onSuccess: (data: notification) => { - console.log("#### : ", data) - setNotification(data) - }, - } - ) + if (!notification || !notification.isActive) { + updateNotiMutation.mutate( + { isActive: true, duration: notification?.duration || "IMMEDIATELY" }, + { + onSuccess: (data: notification) => { + setNotification(data) + }, + } + ) + } else { + updateNotiMutation.mutate( + { isActive: !notification?.isActive, duration: notification?.duration }, + { + onSuccess: (data: notification) => { + setNotification(data) + }, + } + ) + } } const onClickPostureGuide = () => {