mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Add Notification Provider
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user