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.
This commit is contained in:
parent
b06373115b
commit
8922c07e41
@ -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<void>;
|
||||
onLogoutInstance: (instance: WhatsAppInstance) => Promise<void>;
|
||||
onSetPresence: (instance: WhatsAppInstance, presence: 'online' | 'offline') => Promise<void>;
|
||||
|
||||
@ -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 (
|
||||
<Layout>
|
||||
<div className="container mx-auto p-4">
|
||||
@ -83,7 +93,7 @@ const WhatsApp = () => {
|
||||
onRestartInstance={handleRestartInstance}
|
||||
onLogoutInstance={handleLogoutInstance}
|
||||
onSetPresence={handleSetPresence}
|
||||
onDeleteInstance={handleDeleteInstance}
|
||||
onDeleteInstance={handleDeleteInstanceWrapper}
|
||||
onViewQrCode={handleViewQrCode}
|
||||
onRefreshInstances={refreshInstances}
|
||||
isRefreshing={isRefreshing}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user