mirror of
https://github.com/freedbygrace/DynamoDNS.git
synced 2026-07-26 11:38:13 +00:00
Enhance webhook management by adding retry functionality and improved logging
Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/b9fbc26f-a14f-43d9-a5be-61c2452dfa24.jpg
This commit is contained in:
@@ -233,6 +233,33 @@ export default function WebhooksPage() {
|
||||
},
|
||||
});
|
||||
|
||||
// Retry webhook delivery mutation
|
||||
const retryWebhookDeliveryMutation = useMutation({
|
||||
mutationFn: async (logId: string) => {
|
||||
const res = await apiRequest("POST", `/api/webhook-logs/${logId}/retry`);
|
||||
return await res.json();
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
toast({
|
||||
title: "Webhook delivery retried",
|
||||
description: "The webhook delivery has been retried successfully.",
|
||||
});
|
||||
// Refresh the logs to show the new retry attempt
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["/api/webhooks", currentWebhookId, "logs"],
|
||||
});
|
||||
// Reset the selected log
|
||||
setSelectedLog(null);
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
toast({
|
||||
title: "Error retrying webhook",
|
||||
description: error.message,
|
||||
variant: "destructive",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// Fetch webhook delivery logs
|
||||
const {
|
||||
data: webhookLogs = [],
|
||||
@@ -272,6 +299,10 @@ export default function WebhooksPage() {
|
||||
const handleTestWebhook = (id: string) => {
|
||||
testWebhookMutation.mutate(id);
|
||||
};
|
||||
|
||||
const handleRetryWebhook = (logId: string) => {
|
||||
retryWebhookDeliveryMutation.mutate(logId);
|
||||
};
|
||||
|
||||
const handleEditClick = (webhook: Webhook) => {
|
||||
setCurrentWebhook(webhook);
|
||||
@@ -855,13 +886,28 @@ export default function WebhooksPage() {
|
||||
<div className="space-y-4 border p-4 rounded-md">
|
||||
<div className="flex items-center justify-between">
|
||||
<h3 className="text-lg font-medium">Delivery Details</h3>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => setSelectedLog(null)}
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
<div className="flex space-x-2">
|
||||
{!selectedLog.status && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => handleRetryWebhook(selectedLog.id)}
|
||||
disabled={retryWebhookDeliveryMutation.isPending}
|
||||
>
|
||||
{retryWebhookDeliveryMutation.isPending && (
|
||||
<Loader2 className="mr-2 h-3 w-3 animate-spin" />
|
||||
)}
|
||||
<RefreshCw className="mr-1 h-3 w-3" /> Retry
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => setSelectedLog(null)}
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4">
|
||||
|
||||
Reference in New Issue
Block a user