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}