Skip to content

Commit

Permalink
Merge pull request #42 from DDD-Community/feat/#28
Browse files Browse the repository at this point in the history
[Feat/#28] 알림 기능 추가, 모니터링 깜빡임 제거
  • Loading branch information
lkhoony authored Aug 30, 2024
2 parents e246ebb + 3c36e85 commit 2a74db0
Show file tree
Hide file tree
Showing 15 changed files with 428 additions and 121 deletions.
42 changes: 42 additions & 0 deletions src/api/notification.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import axiosInstance from "./axiosInstance"

export type duration = "IMMEDIATELY" | "MIN_15" | "MIN_30" | "MIN_45" | "MIN_60"

export interface notification {
id?: number
isActive?: boolean
duration?: duration
}

export const getNotification = async (): Promise<notification | null> => {
try {
const res = await axiosInstance.get(`/pose-notifications`)

if (!res.data?.data) return null

const { id, duration } = res.data.data
return { id, duration }
} catch (e) {
throw e
}
}

export const modifyNotification = async (notification: notification): Promise<notification> => {
try {
const res = await axiosInstance.post(`/pose-notifications`, { ...notification })
const { id, duration } = res.data.data
return { id, duration }
} catch (e) {
throw e
}
}

export const patchNotification = async (notification: notification): Promise<notification> => {
try {
const res = await axiosInstance.patch(`/pose-notifications/${notification.id}`, { ...notification })
const { id, isActive, duration } = res.data.data
return { id, isActive, duration }
} catch (e) {
throw e
}
}
2 changes: 1 addition & 1 deletion src/components/Camera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function Camera(props: CameraProps): React.ReactElement {

useEffect(() => {
startVideo()
})
}, [])

return (
<div
Expand Down
Loading

0 comments on commit 2a74db0

Please sign in to comment.