Skip to content

Commit

Permalink
fix: multiple name (#2410)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomiir authored Jul 15, 2024
1 parent 9d0fafc commit a993d54
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,21 @@ export class W3mRegisterAccountNameView extends LitElement {

@state() private registered = false

@state() private profileName = AccountController.state.profileName

public constructor() {
super()
this.usubscribe.push(
...[
EnsController.subscribe(val => {
this.suggestions = val.suggestions
this.loading = val.loading
}),
AccountController.subscribeKey('profileName', val => {
this.profileName = val
if (val) {
this.error = 'You already own a name'
}
})
]
)
Expand Down Expand Up @@ -170,7 +178,13 @@ export class W3mRegisterAccountNameView extends LitElement {
}

private isAllowedToSubmit() {
return !this.loading && !this.registered && !this.error && EnsController.validateName(this.name)
return (
!this.loading &&
!this.registered &&
!this.error &&
!this.profileName &&
EnsController.validateName(this.name)
)
}

private async onSubmitName() {
Expand Down

0 comments on commit a993d54

Please sign in to comment.