Refactor QR code scanning result handling in SendDialog.vue

- Cleaned up the scanned result by removing the "lightning:" prefix if present before setting it in the destination field.
- Improved user feedback by ensuring only the cleaned result is processed, enhancing the overall scanning functionality.

These changes enhance the accuracy of QR code scanning results for payment destinations.
This commit is contained in:
padreug 2025-09-18 22:25:43 +02:00
parent d31db59359
commit 7b240fc5be

View file

@ -86,8 +86,14 @@ function closeScanner() {
}
function handleScanResult(result: string) {
// Set the scanned result in the destination field
setFieldValue('destination', result)
// Clean up the scanned result by removing lightning: prefix if present
let cleanedResult = result
if (result.toLowerCase().startsWith('lightning:')) {
cleanedResult = result.substring(10) // Remove "lightning:" prefix
}
// Set the cleaned result in the destination field
setFieldValue('destination', cleanedResult)
closeScanner()
toastService?.success('QR code scanned successfully!')
}