Fix: Remove function prop from client component

Remove onSuccess callback from SyncRoyalMailButton since event handlers
cannot be passed to client components from server components. The button
already shows success/error messages, so the callback wasn't necessary.
This commit is contained in:
Andymick
2026-07-18 20:41:16 +01:00
parent 466f11a866
commit 4ec39d8618
3 changed files with 3 additions and 9 deletions
+1 -4
View File
@@ -5,10 +5,9 @@ import { useState } from 'react';
interface SyncRoyalMailButtonProps {
orderId: string;
trackingNumber?: string | null;
onSuccess?: () => void;
}
export default function SyncRoyalMailButton({ orderId, trackingNumber, onSuccess }: SyncRoyalMailButtonProps) {
export default function SyncRoyalMailButton({ orderId, trackingNumber }: SyncRoyalMailButtonProps) {
const [loading, setLoading] = useState(false);
const [message, setMessage] = useState<{ type: 'success' | 'error'; text: string } | null>(null);
@@ -37,8 +36,6 @@ export default function SyncRoyalMailButton({ orderId, trackingNumber, onSuccess
type: 'success',
text: `Tracking synced! Status: ${data.trackingData.status}`,
});
onSuccess?.();
} catch (err) {
setMessage({ type: 'error', text: 'Error syncing with Royal Mail' });
} finally {