mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 23:27:26 +01:00
Update LightningSettings.tsx
This commit is contained in:
parent
1c01d133e0
commit
2a5003e9e7
1 changed files with 20 additions and 20 deletions
|
@ -100,28 +100,28 @@ const LightningSettings: React.FC = () => {
|
|||
|
||||
setURI(typeof setLndHubUrl === 'string' ? setLndHubUrl.trim() : value.trim());
|
||||
};
|
||||
const save = useCallback(async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
await DefaultPreference.setName(GROUP_IO_BLUEWALLET);
|
||||
if (URI) {
|
||||
const normalizedURI = new URL(URI.replace(/([^:]\/)\/+/g, '$1')).toString();
|
||||
await LightningCustodianWallet.isValidNodeAddress(normalizedURI);
|
||||
const save = useCallback(async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
await DefaultPreference.setName(GROUP_IO_BLUEWALLET);
|
||||
if (URI) {
|
||||
const normalizedURI = new URL(URI.replace(/([^:]\/)\/+/g, '$1')).toString();
|
||||
await LightningCustodianWallet.isValidNodeAddress(normalizedURI);
|
||||
|
||||
await setLNDHub(normalizedURI);
|
||||
} else {
|
||||
await clearLNDHub();
|
||||
await setLNDHub(normalizedURI);
|
||||
} else {
|
||||
await clearLNDHub();
|
||||
}
|
||||
|
||||
presentAlert({ message: loc.settings.lightning_saved, type: AlertType.Toast });
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
||||
} catch (error) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
presentAlert({ message: loc.settings.lightning_error_lndhub_uri });
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
presentAlert({ message: loc.settings.lightning_saved, type: AlertType.Toast });
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
||||
} catch (error) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
presentAlert({ message: loc.settings.lightning_error_lndhub_uri });
|
||||
console.log(error);
|
||||
}
|
||||
setIsLoading(false);
|
||||
}, [URI]);
|
||||
setIsLoading(false);
|
||||
}, [URI]);
|
||||
|
||||
const importScan = () => {
|
||||
navigate('ScanQRCode', {
|
||||
|
|
Loading…
Add table
Reference in a new issue