mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into docu-env-vars
This commit is contained in:
commit
46650133b5
@ -62,12 +62,16 @@ describe('SessionLogoutTimeout', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('token is expired', () => {
|
||||
describe('token is expired for several seconds', () => {
|
||||
beforeEach(() => {
|
||||
mocks.$store.state.tokenTime = setTokenTime(-60)
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('has value for remaining seconds equal 0', () => {
|
||||
expect(wrapper.tokenExpiresInSeconds === 0)
|
||||
})
|
||||
|
||||
it('emits logout', () => {
|
||||
expect(wrapper.emitted('logout')).toBeTruthy()
|
||||
})
|
||||
|
||||
@ -65,7 +65,7 @@ export default {
|
||||
this.$timer.restart('tokenExpires')
|
||||
this.$bvModal.show('modalSessionTimeOut')
|
||||
}
|
||||
if (this.tokenExpiresInSeconds <= 0) {
|
||||
if (this.tokenExpiresInSeconds === 0) {
|
||||
this.$timer.stop('tokenExpires')
|
||||
this.$emit('logout')
|
||||
}
|
||||
@ -90,7 +90,10 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
tokenExpiresInSeconds() {
|
||||
return Math.floor((new Date(this.$store.state.tokenTime * 1000).getTime() - this.now) / 1000)
|
||||
const remainingSecs = Math.floor(
|
||||
(new Date(this.$store.state.tokenTime * 1000).getTime() - this.now) / 1000,
|
||||
)
|
||||
return remainingSecs <= 0 ? 0 : remainingSecs
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user