diff --git a/client/src/Hooks/useNotifications.js b/client/src/Hooks/useNotifications.js
index cc6c3e875..7feebd44c 100644
--- a/client/src/Hooks/useNotifications.js
+++ b/client/src/Hooks/useNotifications.js
@@ -65,14 +65,16 @@ const useDeleteNotification = () => {
const [error, setError] = useState(null);
const { t } = useTranslation();
- const deleteNotification = async (id, triggerUpdate) => {
+ const deleteNotification = async (id, callback) => {
try {
setIsLoading(true);
await networkService.deleteNotificationById({ id });
createToast({
body: t("notifications.delete.success"),
});
- triggerUpdate();
+ if (callback) {
+ callback();
+ }
} catch (error) {
setError(error);
createToast({
diff --git a/client/src/Pages/Notifications/components/ActionMenu.jsx b/client/src/Pages/Notifications/components/ActionMenu.jsx
index fb971500b..d57ad931f 100644
--- a/client/src/Pages/Notifications/components/ActionMenu.jsx
+++ b/client/src/Pages/Notifications/components/ActionMenu.jsx
@@ -60,12 +60,12 @@ const ActionMenu = ({ notification, onDelete }) => {
onClick={(e) => e.stopPropagation()}
onMouseDown={(e) => e.stopPropagation()}
>
-
+
>
diff --git a/client/src/Pages/Notifications/create/index.jsx b/client/src/Pages/Notifications/create/index.jsx
index ec244db29..8b7c4ccf5 100644
--- a/client/src/Pages/Notifications/create/index.jsx
+++ b/client/src/Pages/Notifications/create/index.jsx
@@ -36,11 +36,10 @@ const CreateNotifications = () => {
const { notificationId } = useParams();
const navigate = useNavigate();
const theme = useTheme();
- const [createNotification, isCreating, createNotificationError] =
- useCreateNotification();
- const [editNotification, isEditing, editNotificationError] = useEditNotification();
- const [testNotification, isTesting, testNotificationError] = useTestNotification();
- const [deleteNotification, isDeleting, deleteError] = useDeleteNotification();
+ const [createNotification, isCreating] = useCreateNotification();
+ const [editNotification, isEditing] = useEditNotification();
+ const [testNotification, isTesting] = useTestNotification();
+ const [deleteNotification, isDeleting] = useDeleteNotification();
const BREADCRUMBS = [
{ name: "notifications", path: "/notifications" },
@@ -61,7 +60,7 @@ const CreateNotifications = () => {
const [errors, setErrors] = useState({});
const { t } = useTranslation();
- const [notificationIsLoading, getNotificationError] = useGetNotificationById(
+ const [notificationIsLoading] = useGetNotificationById(
notificationId,
setNotification
);
@@ -136,17 +135,7 @@ const CreateNotifications = () => {
const onDelete = () => {
if (notificationId) {
- deleteNotification(
- notificationId,
- () => navigate("/notifications"), // Success callback
- (error) => {
- // Error handling
- createToast({
- body: `Delete failed: ${error.message}`,
- type: "error",
- });
- }
- );
+ deleteNotification(notificationId, () => navigate("/notifications"));
}
};