mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2025-08-27 04:59:22 +00:00
Fallback to manual payment if webln fails - might be due to user intentionally closing out of it v2
This commit is contained in:
parent
3101532a2b
commit
6845e6cf7c
@ -262,7 +262,10 @@ export function useZaps(
|
|||||||
variant: 'destructive',
|
variant: 'destructive',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (webln) { // Try WebLN next
|
}
|
||||||
|
|
||||||
|
if (webln) { // Try WebLN next
|
||||||
|
try {
|
||||||
await webln.sendPayment(newInvoice);
|
await webln.sendPayment(newInvoice);
|
||||||
|
|
||||||
// Clear states immediately on success
|
// Clear states immediately on success
|
||||||
@ -279,6 +282,20 @@ export function useZaps(
|
|||||||
|
|
||||||
// Close dialog last to ensure clean state
|
// Close dialog last to ensure clean state
|
||||||
onZapSuccess?.();
|
onZapSuccess?.();
|
||||||
|
} catch (weblnError) {
|
||||||
|
console.error('webln payment failed, falling back:', weblnError);
|
||||||
|
|
||||||
|
// Show specific WebLN error to user for debugging
|
||||||
|
const errorMessage = weblnError instanceof Error ? weblnError.message : 'Unknown WebLN error';
|
||||||
|
toast({
|
||||||
|
title: 'WebLN payment failed',
|
||||||
|
description: `${errorMessage}. Falling back to other payment methods...`,
|
||||||
|
variant: 'destructive',
|
||||||
|
});
|
||||||
|
|
||||||
|
setInvoice(newInvoice);
|
||||||
|
setIsZapping(false);
|
||||||
|
}
|
||||||
} else { // Default - show QR code and manual Lightning URI
|
} else { // Default - show QR code and manual Lightning URI
|
||||||
setInvoice(newInvoice);
|
setInvoice(newInvoice);
|
||||||
setIsZapping(false);
|
setIsZapping(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user