Added notifications for actual news
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { verifyToken, getUserById, hasAnyRole } from '../utils/auth.js'
|
||||
import { saveTermin } from '../utils/termine.js'
|
||||
import { sendNewEventPush } from '../utils/push-notifications.js'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
try {
|
||||
@@ -41,13 +42,17 @@ export default defineEventHandler(async (event) => {
|
||||
})
|
||||
}
|
||||
|
||||
await saveTermin({
|
||||
const termin = {
|
||||
datum,
|
||||
uhrzeit: uhrzeit || '',
|
||||
titel,
|
||||
beschreibung: beschreibung || '',
|
||||
kategorie: kategorie || 'Sonstiges'
|
||||
})
|
||||
}
|
||||
await saveTermin(termin)
|
||||
sendNewEventPush(termin)
|
||||
.then(result => console.info('Termin-Push Ergebnis:', { titel: termin.titel, ...result }))
|
||||
.catch(error => console.error('Termin-Push fehlgeschlagen:', error))
|
||||
|
||||
return {
|
||||
success: true,
|
||||
|
||||
Reference in New Issue
Block a user