-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#493): Adding user my portal page
- Loading branch information
Showing
1 changed file
with
5 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |