Skip to content

Commit

Permalink
fix: adds missing resetErrors function in AddNetworkAddressDrawer (#2372
Browse files Browse the repository at this point in the history
)

* fix: adds missing resetErrors function in AddNetworkAddressDrawer

* chore: remove dead code

---------

Co-authored-by: Tuditi <[email protected]>
Co-authored-by: Tuditi <[email protected]>
  • Loading branch information
3 people authored Apr 25, 2024
1 parent aae094c commit f408e8f
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
export let drawerRouter: Router<unknown>
let addressInput, addressNameInput: TextInput
let networkSelectionInput: NetworkInput
let address: string = ''
let addressName: string = ''
Expand All @@ -34,12 +33,20 @@
Network = 'network',
}
const validationErrors: { [key in AddressField]: string | undefined } = {
let validationErrors: { [key in AddressField]: string | undefined } = {
[AddressField.Address]: undefined,
[AddressField.Name]: undefined,
[AddressField.Network]: undefined,
}
function resetErrors(): void {
validationErrors = {
[AddressField.Address]: undefined,
[AddressField.Name]: undefined,
[AddressField.Network]: undefined,
}
}
function onSaveClick(): void {
if (validate()) {
ContactManager.addContactAddress($selectedContact?.id, selectedNetworkId, addressName, address)
Expand Down Expand Up @@ -90,13 +97,11 @@
bind:error={validationErrors[AddressField.Network]}
/>
<TextInput
bind:this={addressInput}
bind:value={address}
bind:error={validationErrors[AddressField.Address]}
label={localize('general.address')}
/>
<TextInput
bind:this={addressNameInput}
bind:value={addressName}
bind:error={validationErrors[AddressField.Name]}
label={localize('general.addressName')}
Expand Down

0 comments on commit f408e8f

Please sign in to comment.