Skip to content

Commit

Permalink
fix: create cert link
Browse files Browse the repository at this point in the history
  • Loading branch information
MGrgr committed Oct 27, 2023
1 parent 4c12b49 commit f03b6f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/Header/HeaderCertificate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const expiredAt = computed(() => {
unelevated
:color="userStore.certificate && !isProved ? 'teal-14' : 'yellow'"
text-color="black"
:href="`${ALBUS_APP_URL}/wizard/policy-pubkey`"
:href="`${ALBUS_APP_URL}/wizard/${userStore.requiredPolicy}`"
target="_blank"
type="a"
/>
Expand Down
13 changes: 10 additions & 3 deletions src/stores/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,20 @@ export const useUserStore = defineStore('user', () => {
}
}

const certificate = computed(() => {
const requiredPolicy = computed(() => {
if (route.name) {
const pagePolicy = POLICY[route.name]
if (pagePolicy) {
const policyPubkey = pagePolicy.default
return state.certificates?.find((c: any) => c.data.policy.toBase58() === policyPubkey)
return pagePolicy.default
}
}
return ''
})

const certificate = computed(() => {
if (requiredPolicy.value) {
return state.certificates?.find((c: any) => c.data.policy.toBase58() === requiredPolicy.value)
}
return null
})

Expand All @@ -131,6 +137,7 @@ export const useUserStore = defineStore('user', () => {
return {
state,
certificate,
requiredPolicy,
getTokens,
tokenBalance,
reloadUserTokens,
Expand Down

0 comments on commit f03b6f3

Please sign in to comment.