Check Notification Test Status

This commit is contained in:
headlesdev
2025-05-25 21:43:42 +02:00
parent 78f1d54fc3
commit fb13c2bfce
4 changed files with 101 additions and 8 deletions

View File

@@ -11,11 +11,13 @@ import Loading from '@/components/Loading';
export const NotificationSettings = ({ onError, onSuccess }: { onError: (message: string) => void, onSuccess: (message: string) => void }) => {
const { loadNotifications, notifications, loading, testNotification } = useNotifications();
const [deleteNotificationId, setDeleteNotificationId] = useState<number | null>(null);
const [notificationTestId, setNotificationTestId] = useState<number | null>(null);
const testNotificationHandler = async (notificationProviderId: number) => {
(document.getElementById('test_notification') as HTMLDialogElement)?.showModal();
await testNotification(notificationProviderId);
const notificationTest = await testNotification(notificationProviderId);
setNotificationTestId(notificationTest.id);
}
return (
@@ -79,7 +81,9 @@ export const NotificationSettings = ({ onError, onSuccess }: { onError: (message
{deleteNotificationId && (
<DeleteNotification notificationId={deleteNotificationId} onNotificationDeleted={loadNotifications} onError={onError} onSuccess={onSuccess} />
)}
<TestNotification />
{notificationTestId && (
<TestNotification notificationTestId={notificationTestId} />
)}
</div>
</div>
);