Skip to content
Snippets Groups Projects
Commit 5c265260 authored by Dominik Seeger's avatar Dominik Seeger Committed by robinwilliam.hundt
Browse files

fixed logout component not showing dialog

parent 3220395f
No related branches found
No related tags found
1 merge request!142Resolve "AutoLogout Component, watcher on lastAppInteraction"
Pipeline #89950 passed
......@@ -31,13 +31,14 @@
<script lang="ts">
import Vue from 'vue'
import Component, { mixins } from 'vue-class-component'
import { Watch } from 'vue-property-decorator'
import { mapState } from 'vuex'
import { Authentication } from '@/store/modules/authentication'
import { actions } from '@/store/actions'
import { getters } from '@/store/getters'
@Component({
name: 'auto-logout',
computed: {...mapState(['lastAppInteraction'])}
name: 'auto-logout'
})
export default class AutoLogout extends Vue {
timer = 0
......@@ -46,6 +47,7 @@ export default class AutoLogout extends Vue {
get lastTokenRefreshTry () { return Authentication.state.lastTokenRefreshTry }
get refreshingToken () { return Authentication.state.refreshingToken }
get jwtTimeDelta () { return Authentication.state.jwtTimeDelta }
get lastAppInteraction () { return getters.state.lastAppInteraction }
logout () {
this.logoutDialog = false
......@@ -57,7 +59,8 @@ export default class AutoLogout extends Vue {
this.logoutDialog = false
}
lastAppInteraction () {
@Watch('lastAppInteraction')
onLastInteractionChange () {
const timeSinceLastRefresh = Date.now() - this.lastTokenRefreshTry
const timeDelta = this.jwtTimeDelta
// refresh jwt if it's older than 20% of his maximum age
......@@ -67,10 +70,6 @@ export default class AutoLogout extends Vue {
}
}
watch () {
this.lastAppInteraction()
}
mounted () {
this.timer = setInterval(() => {
const timeDialogAppearsBeforeLogout = Math.min(600 * 1e3,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment