Test Notifications client

This commit is contained in:
headlesdev
2025-05-25 21:03:37 +02:00
parent 67909493a2
commit 3d982bf1ac
4 changed files with 79 additions and 3 deletions

View File

@@ -41,12 +41,23 @@ const useNotifications = () => {
});
}
const testNotification = (notificationProviderId: number): Promise<string> | string => {
return axios.post('/api/notifications/test', { notificationProviderId })
.then((response) => {
return response.data.notificationTest;
})
.catch(err => {
throw err.response?.data?.error || 'An error occurred';
});
}
return {
notifications,
loading,
addNotification,
deleteNotification,
loadNotifications
loadNotifications,
testNotification
};
}