Skip to content

Commit

Permalink
feat(#493): Adding user my portal page
Browse files Browse the repository at this point in the history
  • Loading branch information
tholulomo committed Jun 23, 2024
1 parent 63a9297 commit 7a3723a
Showing 1 changed file with 5 additions and 98 deletions.
103 changes: 5 additions & 98 deletions app/src/pages/portal/Home.vue
Original file line number Diff line number Diff line change
@@ -1,106 +1,13 @@
<template>
<div class="">
<div class=" viz-u-mgup-sm utility-margin md-theme-default">
<div class="md-card-header contactus_radios md-card-header-flex">
<div class="md-card-header-text">
<div class="md-body-1">Here is a summary of your account details</div>
</div>
</div>
<md-divider class="u_margin-top-small"></md-divider>
</div>

<div class="article_citations ">
<div>
<div class="md-layout md-gutter viz-u-mgbottom-big">
<div class="md-layout-item md-size-50 md-gutter">
<h4 class="u--color-grey-sec md-button-content">surname</h4>
<p>{{ user.surName }}</p>
</div>

<div class="md-layout-item md-size-50 md-gutter">
<h4 class="u--color-grey-sec md-button-content">given name</h4>
<p>{{ user.givenName }}</p>
</div>
</div>

<div class="md-layout md-gutter viz-u-mgbottom-big">
<div class="md-layout-item md-size-50 md-gutter">
<h4 class="u--color-grey-sec md-button-content">Admin status</h4>
<p>{{ isAdmin ? 'Admin' : 'False' }}</p>
</div>

<div class="md-layout-item md-size-50 md-gutter">
<h4 class="u--color-grey-sec md-button-content">Token</h4>
<p>{{ hours }}</p>
</div>
</div>

<div class="">
<h4 class="u--color-grey-sec md-button-content">token</h4>
<div style="word-wrap: break-word;" class=" md-card-header chart_editor__right-view">
{{ token }}
</div>
<div class="md-card-actions md-alignment-right chart_editor__right-view ">
<button @click.prevent="copyContent" class="md-button btn btn--primary btn--noradius ">
<span class="md-caption u--bg">Copy token</span>
</button>
</div>
</div>
</div>
</div>
</div>
<account />
</template>

<script>
import { mapGetters } from 'vuex'
import account from '@/components/portal/Account.vue';
export default {
name: 'PortalHome',
data () {
return {
hours: 0
}
},
computed: {
...mapGetters({
token: 'auth/token',
user: 'auth/user',
isAdmin: 'auth/isAdmin'
})
},
methods: {
async copyContent () {
try {
await navigator.clipboard.writeText(this.token)
this.$store.commit('setSnackbar', {
message: 'Token copied successfully',
duration: 4000
})
} catch (error) {
this.$store.commit('setSnackbar', {
message: 'Something went wrong',
action: () => this.copyContent()
})
}
},
countDown () {
const tokenExpiration = localStorage.getItem('tokenExpiration')
if (!tokenExpiration) {
this.hours = 'Token already expired'
return
}
const expiresIn = new Date(+tokenExpiration).getTime() - new Date().getTime()
if (expiresIn <= 0) {
this.hours = 'Token already expired'
return
}
this.hours = `Expires in ${Math.round((expiresIn / (60 * 60 * 1000)) * 100) / 100} hours`
}
},
created () {
this.$store.commit('setAppHeaderInfo', { icon: '', name: 'Account Information' })
this.countDown()
components: {
account
}
}
};
</script>

0 comments on commit 7a3723a

Please sign in to comment.