From c274ea165175c42d0355a8cea5df50e2fec7326a Mon Sep 17 00:00:00 2001 From: ww8007 Date: Tue, 25 Jul 2023 00:03:16 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=95=8C=EB=A6=BC=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=B4=EC=84=9C=20=ED=82=A4=EA=B3=A0/=EB=81=84=EB=8A=94=20?= =?UTF-8?q?=EA=B2=83=EC=97=90=20=EB=8C=80=ED=95=B4=20api=20=EC=97=B0?= =?UTF-8?q?=EB=8F=99=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/members/ui/NotificationSettingBox.tsx | 35 +++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/members/ui/NotificationSettingBox.tsx b/src/members/ui/NotificationSettingBox.tsx index 7a436aa4..f3e5cdb3 100644 --- a/src/members/ui/NotificationSettingBox.tsx +++ b/src/members/ui/NotificationSettingBox.tsx @@ -10,7 +10,10 @@ import { import RoundToggle from '@/common-ui/RoundToggle'; import NotificationSettingsBottomSheet from '@/members/ui/NotificationSettingsBottomSheet'; import useBottomSheet from '@/common-ui/BottomSheet/hooks/useBottomSheet'; -import { useGETNotificationStandardsQuery } from '../api/member'; +import { + useGETNotificationStandardsQuery, + usePUTNotificationStandardsQuery, +} from '../api/member'; import useAuthStore from '@/store/auth'; const NotificationSettingBox = ({ @@ -33,6 +36,32 @@ const NotificationSettingBox = ({ } }, [defaultTime]); + const { mutate } = usePUTNotificationStandardsQuery({ + loginId: memberId, + }); + + const onActive = () => { + setIsNotificationOn(true); + mutate({ + loginId: memberId, + putData: { + isActive: true, + notifyDailyAt: defaultTime?.notifyDailyAt || '09:00', + }, + }); + }; + + const onDeactivate = () => { + setIsNotificationOn(false); + mutate({ + loginId: memberId, + putData: { + isActive: false, + notifyDailyAt: defaultTime?.notifyDailyAt || '09:00', + }, + }); + }; + return ( <> setIsNotificationOn(true)} - setOff={() => setIsNotificationOn(false)} + setOn={onActive} + setOff={onDeactivate} />