portfolio/lib/ntfy.ts
Ryan Freeman 272a5cecab
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m12s
Improve comment error handling
2025-04-21 17:03:29 +01:00

19 lines
536 B
TypeScript

import fetcher from '@/lib/fetcher'
const NTFY_URL = process.env.NTFY_URL ?? ''
export async function sendNotification(notificationBody: any) {
if (NTFY_URL !== '') {
try {
await fetcher(NTFY_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(notificationBody)
})
} catch (error) {
console.error('Failed to send notification:', error)
}
}
}