Skip to content

Commit b737f07

Browse files
committed
Hide vote button if user does not have account_name, for user's node.'
1 parent dc073a2 commit b737f07

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/pages/Index.vue

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@
144144
<q-item-section side center>
145145
<q-item-label class="code text-vgreen" caption> {{ node.balance }} </q-item-label>
146146
</q-item-section>
147-
<q-item-section avatar>
148-
<q-btn outline color="vgreen" v-on:click="addToVote(node)" v-if="node.account != 'No account found' && !voting_list.includes(node) ">Vote</q-btn>
149-
<q-btn color="vgreen" class="text-vdark" v-on:click="addToVote(node)" v-if="node.account != 'No account found' && voting_list.includes(node)">Vote</q-btn>
147+
<q-item-section avatar v-if="identity.account_name && node.account != identity.account_name && node.account != 'No account found'">
148+
<q-btn outline color="vgreen" v-on:click="addToVote(node)" v-if="!voting_list.includes(node) ">Vote</q-btn>
149+
<q-btn color="vgreen" class="text-vdark" v-on:click="addToVote(node)" v-if="voting_list.includes(node)">Vote</q-btn>
150150
</q-item-section>
151151
</q-item>
152152
</q-list>
@@ -499,16 +499,20 @@ export default {
499499
const eos = new EosWrapper()
500500
try {
501501
let accounts = await eos.getAccounts(key)
502-
this.identity.account_name = accounts.account_names[0]
503-
this.checkAccountAdded()
504-
this.checkAccountRegistered()
505-
this.checkAccountRun()
506-
this.getUptime()
507-
this.getRank()
508-
this.getBalance()
509-
this.getVoted()
502+
this.identity.account_name = accounts.account_names[0] ? accounts.account_names[0] : ''
503+
if (this.identity.account_name) {
504+
this.checkAccountAdded()
505+
this.checkAccountRegistered()
506+
this.checkAccountRun()
507+
this.getUptime()
508+
this.getRank()
509+
this.getBalance()
510+
this.getVoted()
511+
} else {
512+
this.errorMessage = 'Seems like you don\'t have an EOS account. An account is required to work with a vDexNode. Please create one using your public key.'
513+
this.errorDialog = true
514+
}
510515
} catch (error) {
511-
this.identity.account_name = 'none'
512516
this.errorMessage = error
513517
this.errorDialog = true
514518
}

0 commit comments

Comments
 (0)