useDirectusNotifications
Check out the Directus Notifications documentation.
getNotifications
Search for notifications, global search querys
can be used
- Arguments:
- data:
params
- data:
- Returns:
Array<T>
pages/notifications.vue
<script setup>const { getNotifications } = useDirectusNotifications();const router = useRouter();const notifications = await getNotifications({ params: { filter: { subject: "Directus is great!" }, },});</script>
getNotificationByKey
Get notifications by primary id key.
- Arguments:
- data:
id, params
- data:
- Returns:
Object<T>
pages/notifications.vue
<script setup>const { getNotificationByKey } = useDirectusNotifications();const notification = await getNotificationByKey({ id: "2",});</script>
createNotification
Create one notifications
Partial notification object can be provided
- Arguments:
- Returns:
DirectusNotificationObject
pages/notifications.vue
<script setup>const { createNotification } = useDirectusNotifications();await createNotification({ recipient: "13231234saf-24wasf", subject: "Hey there!",});</script>
deleteNotifications
Delete one or multiple notifications, provide notification id's.
- Arguments:
- data:
Array<string> | string;
- data:
- Returns:
Empty body
pages/notifications.vue
<script setup>const { deleteNotifications } = useDirectusNotifications();const notifications = ["15", "20", "22"];await deleteNotifications({ notifications });</script>
What do you think?