Skip to content

Commit

Permalink
Make testnet faucet page more efficient by adding input validation te…
Browse files Browse the repository at this point in the history
  • Loading branch information
TusharKarkera22 committed Jan 24, 2024
1 parent a63bb37 commit a6aa0e0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/pages/testnet/DevelopersPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ export default {
submitting: false,
};
},
computed: {
isCreateAccountButtonDisabled() {
return (
!this.form.account_name ||
!this.form.owner_key ||
!this.form.active_key ||
this.submitting
);
},
isAnyInputInvalid() {
return (
!this.form.account_name ||
!/^EOS[0-9A-Za-z]{50}$/.test(this.form.owner_key) ||
!/^EOS[0-9A-Za-z]{50}$/.test(this.form.active_key)
);
},
},
methods: {
...mapActions('testnet', ['faucet', 'evmFaucet', 'account']),
async onFaucet() {
Expand Down Expand Up @@ -85,13 +103,16 @@ q-page.flex.flex-center
ref="owner_key"
v-model="form.owner_key"
color="accent"
:rules="[ val => /^EOS[0-9A-Za-z]{50}$/.test(val) || 'Please provide a valid Owner key']"
label="Owner key"
outlined
)
q-input.q-mb-lg(
ref="active_key"
v-model="form.active_key"
color="accent"
:rules="[ val => /^EOS[0-9A-Za-z]{50}$/.test(val) || 'Please provide a valid Active key']"

label="Active key"
outlined
)
Expand All @@ -101,6 +122,7 @@ q-page.flex.flex-center
size="lg"
unelevated
:loading="submitting"
:disable="isAnyInputInvalid"
@click="onAccount"
)

Expand Down

0 comments on commit a6aa0e0

Please sign in to comment.