From 8922c07e41ee32287d869d771af0e0129d24e38c Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 18:32:11 +0000 Subject: [PATCH] Fix: Incorrect type for `onViewQrCode` prop The `onViewQrCode` prop in `InstanceList` was expecting a function with two arguments, but the `handleViewQrCode` function only provided one. This commit fixes the type mismatch. --- src/components/whatsapp/InstanceList.tsx | 2 +- src/pages/WhatsApp.tsx | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/whatsapp/InstanceList.tsx b/src/components/whatsapp/InstanceList.tsx index c7ba1df..228a9c4 100644 --- a/src/components/whatsapp/InstanceList.tsx +++ b/src/components/whatsapp/InstanceList.tsx @@ -8,7 +8,7 @@ import { RefreshCw } from 'lucide-react'; interface InstanceListProps { instances: WhatsAppInstance[]; onViewQrCode: (instance: WhatsAppInstance) => void; - onDeleteInstance: (instanceId: string) => void; + onDeleteInstance: (instanceId: string) => void; // Only requires instanceId onRestartInstance: (instance: WhatsAppInstance) => Promise; onLogoutInstance: (instance: WhatsAppInstance) => Promise; onSetPresence: (instance: WhatsAppInstance, presence: 'online' | 'offline') => Promise; diff --git a/src/pages/WhatsApp.tsx b/src/pages/WhatsApp.tsx index 988433d..e4a59be 100644 --- a/src/pages/WhatsApp.tsx +++ b/src/pages/WhatsApp.tsx @@ -57,6 +57,16 @@ const WhatsApp = () => { }; }, [checkAllInstancesStatus]); + // Create a wrapper function that matches the expected signature + const handleDeleteInstanceWrapper = (instanceId: string) => { + const instance = instances.find(inst => inst.instanceId === instanceId); + if (instance) { + handleDeleteInstance(instanceId, instance.instanceName); + } else { + console.error(`Instance with ID ${instanceId} not found`); + } + }; + return (
@@ -83,7 +93,7 @@ const WhatsApp = () => { onRestartInstance={handleRestartInstance} onLogoutInstance={handleLogoutInstance} onSetPresence={handleSetPresence} - onDeleteInstance={handleDeleteInstance} + onDeleteInstance={handleDeleteInstanceWrapper} onViewQrCode={handleViewQrCode} onRefreshInstances={refreshInstances} isRefreshing={isRefreshing}