added profile and token refresh

This commit is contained in:
Tobias Kurze
2019-04-05 16:20:54 +02:00
parent 91edb27529
commit 9a91f40c65
3 changed files with 47 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
<section class="hero is-primary">
<div class="hero-body">
<div class="container has-text-centered">
<h2 class="title">Profile</h2>
<h2 class="title">Profile ({{tokenValidity}})</h2>
<p>{{profile.id}}</p>
<p class="subtitle error-msg">{{ errorMsg }}</p>
</div>
@@ -16,12 +16,14 @@
<script>
import { EventBus } from '@/utils'
import {getRemainingJwtValiditySeconds} from "../utils";
export default {
data () {
return {
email: '',
errorMsg: '',
tokenValidity: -1,
};
},
methods: {
@@ -37,6 +39,13 @@
});
this.$store.dispatch('loadProfile');
this.$nextTick(() =>{
window.setInterval(() => {
this.$log.debug(getRemainingJwtValiditySeconds(this.$store.state.access_token));
this.tokenValidity = getRemainingJwtValiditySeconds(this.$store.state.access_token);
}, 1000);
});
},
beforeDestroy () {