Skip to content

Commit

Permalink
load BrightId data for status check
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Aug 23, 2022
1 parent 1653bc8 commit 9eab8a1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions vue-app/src/views/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ export default class Profile extends Vue {
async created() {
this.isLoading = true
await this.loadProjects()
if (this.showBrightIdWidget) {
await this.$store.dispatch('LOAD_BRIGHT_ID')
}
this.isLoading = false
}
Expand Down
5 changes: 4 additions & 1 deletion vue-app/src/views/Verify.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,17 @@ export default class VerifyView extends Vue {
return -1
}
created() {
async created() {
if (
!this.currentUser?.walletAddress ||
this.$store.getters.hasContributionPhaseEnded
) {
this.$router.replace({ name: 'verify' })
}
// make sure BrightId status is availabel before page load
await this.loadBrightId()
// redirect to the verify success page if the user is registered
if (this.currentStep < 0) {
this.$router.replace({ name: 'verified' })
Expand Down
10 changes: 9 additions & 1 deletion vue-app/src/views/VerifyLanding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@
:isActionButton="true"
:fullWidthMobile="true"
/>
<links v-if="currentUser" to="/verify/connect" class="btn-primary">
<links
v-if="showBrightIdButton"
to="/verify/connect"
class="btn-primary"
>
I have BrightID installed
</links>
</div>
Expand Down Expand Up @@ -148,6 +152,10 @@ export default class VerifyLanding extends Vue {
return this.$store.getters.hasContributionPhaseEnded
}
get showBrightIdButton(): boolean {
return this.currentUser?.isRegistered === false
}
formatDuration(value: number): string {
return humanizeDuration(value * 1000, { largest: 1 })
}
Expand Down

0 comments on commit 9eab8a1

Please sign in to comment.