diff --git a/src/components/Posture/PostrueCrew.tsx b/src/components/Posture/PostrueCrew.tsx
index 5bd9c74..397aef4 100644
--- a/src/components/Posture/PostrueCrew.tsx
+++ b/src/components/Posture/PostrueCrew.tsx
@@ -201,6 +201,9 @@ export default function PostrueCrew(props: PostureCrewProps): ReactElement {
value={NOTI_VALUE_MAP(notification?.duration)}
onClick={onClickNotiAlarmTime}
/>
+ {!hasPermission && (
+
브라우저의 알람 권한 설정이 필요 합니다.
+ )}
diff --git a/src/hooks/useNotiMutation.ts b/src/hooks/useNotiMutation.ts
index 3313e70..820e017 100644
--- a/src/hooks/useNotiMutation.ts
+++ b/src/hooks/useNotiMutation.ts
@@ -13,9 +13,6 @@ export const useModifyNoti = (): UseMutationResult {
return registerNotification(notification)
},
- onSuccess: (data) => {
- console.log(data)
- },
})
}
diff --git a/src/hooks/useNotification.ts b/src/hooks/useNotification.ts
index eda0737..2eed7a6 100644
--- a/src/hooks/useNotification.ts
+++ b/src/hooks/useNotification.ts
@@ -1,30 +1,42 @@
-import { getNotification, notification } from "@/api/notification"
+import { getNotification } from "@/api/notification"
import { useNotificationStore } from "@/store/NotificationStore"
-import { useQuery } from "@tanstack/react-query"
-import { useEffect } from "react"
+import { useEffect, useState } from "react"
export default function useNotification() {
const { notification, setNotification } = useNotificationStore()
+ const [isLoading, setIsLoading] = useState(true)
// Fetch group data
- const { data, isLoading, error } = useQuery<{ data: notification }, Error>({
- queryKey: ["notification"],
- queryFn: getNotification,
- staleTime: 60 * 1000,
- retry: false,
- enabled: !notification,
- })
+ // const { data, isLoading, error } = useQuery<{ data: notification }, Error>({
+ // queryKey: ["notification"],
+ // queryFn: getNotification,
+ // staleTime: 60 * 1000,
+ // })
+
+ // useEffect(() => {
+ // if (data) {
+ // setNotification(data.data)
+ // }
+ // }, [data])
useEffect(() => {
- if (data) {
- setNotification(data.data)
+ if (!notification) {
+ getNotification()
+ .then(({ data }) => {
+ setNotification(data)
+ setIsLoading(false)
+ })
+ .catch((error) => {
+ console.log("useNotification Error: ", error)
+ setIsLoading(false)
+ })
}
- }, [data])
+ }, [notification])
return {
notification,
setNotification,
isLoading,
- error,
+ // error,
}
}