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:
parent
d31db59359
commit
7b240fc5be
1 changed files with 8 additions and 2 deletions
|
|
@ -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!')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue