added more fields (read only atm) for recorders
This commit is contained in:
11
src/App.vue
11
src/App.vue
@@ -87,6 +87,7 @@
|
||||
return {
|
||||
isLoading: false,
|
||||
tokenValidity: -1,
|
||||
refreshFailed: false,
|
||||
refreshTokenValidity: -1,
|
||||
showAlert: true,
|
||||
alertMessage: 'NO MESSAGE PROVIDED',
|
||||
@@ -112,15 +113,23 @@
|
||||
EventBus.$on('failedLoadingRooms', (msg) => {
|
||||
this.showErrorMessage(msg);
|
||||
});
|
||||
EventBus.$on('failedRefreshingToken', (msg)=>{
|
||||
this.refreshFailed = true;
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
window.setInterval(() => {
|
||||
// this.$log.debug(getRemainingJwtValiditySeconds(this.$store.state.access_token));
|
||||
this.tokenValidity = getRemainingJwtValiditySeconds(this.$store.state.access_token);
|
||||
this.refreshTokenValidity = getRemainingJwtValiditySeconds(this.$store.state.refresh_token);
|
||||
// this.$log.debug(this.$store.state);
|
||||
if (this.tokenValidity < 50 && this.refreshTokenValidity > 30) {
|
||||
if (this.tokenValidity < 50 && this.refreshTokenValidity > 30 && !this.refreshFailed) {
|
||||
this.$store.dispatch('refreshToken'); // renew access token
|
||||
}
|
||||
if(this.refreshFailed){
|
||||
this.$store.dispatch('resetToken'); // delete all token info if refresh fails
|
||||
this.$router.push({ name: 'login'});
|
||||
this.refreshFailed = false;
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user