Add Notification Provider

This commit is contained in:
headlesdev
2025-05-25 00:32:16 +02:00
parent ddc88796d2
commit 6ba144b7bd
6 changed files with 153 additions and 6 deletions

View File

@@ -25,6 +25,9 @@ const useNotifications = () => {
return axios.post('/api/notifications/add', { name, type, config })
.then((response) => {
return response.data.notification;
})
.catch(err => {
throw err.response?.data?.error || 'An error occurred';
});
};
@@ -38,5 +41,13 @@ const useNotifications = () => {
});
}
return { notifications, loading, addNotification, deleteNotification };
}
return {
notifications,
loading,
addNotification,
deleteNotification,
loadNotifications
};
}
export default useNotifications;