Merge pull request #2681 from gradido/2675-Toast-Message-when-forced-to-logout-clientside

refactor(frontend):  toast by automatically logged out
This commit is contained in:
Moriz Wahl 2023-02-09 17:51:17 +01:00 committed by GitHub
commit c22a363938
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 1 deletions

View File

@ -116,5 +116,15 @@ describe('ContributionList', () => {
expect(wrapper.emitted('delete-contribution')).toEqual([[{ id: 2 }]])
})
})
describe('update status', () => {
beforeEach(() => {
wrapper.findComponent({ name: 'ContributionListItem' }).vm.$emit('update-state', { id: 2 })
})
it('emits update status', () => {
expect(wrapper.emitted('update-state')).toEqual([[{ id: 2 }]])
})
})
})
})

View File

@ -67,6 +67,7 @@ export default {
}
if (this.tokenExpiresInSeconds === 0) {
this.$timer.stop('tokenExpires')
this.toastInfoNoHide(this.$t('session.automaticallyLoggedOut'))
this.$emit('logout')
}
},
@ -84,6 +85,7 @@ export default {
})
.catch(() => {
this.$timer.stop('tokenExpires')
this.toastInfoNoHide(this.$t('session.automaticallyLoggedOut'))
this.$emit('logout')
})
},

View File

@ -272,6 +272,7 @@
"send_gdd": "GDD versenden",
"send_per_link": "GDD versenden per Link",
"session": {
"automaticallyLoggedOut": "Du wurdest automatisch abgemeldet",
"extend": "Angemeldet bleiben",
"lightText": "Wenn du länger als 10 Minuten keine Aktion getätigt hast, wirst du aus Sicherheitsgründen abgemeldet.",
"logoutIn": "Abmelden in ",

View File

@ -272,6 +272,7 @@
"send_gdd": "Send GDD",
"send_per_link": "Send GDD via Link",
"session": {
"automaticallyLoggedOut": "You have been automatically logged out.",
"extend": "Stay logged in",
"lightText": "If you have not performed any action for more than 10 minutes, you will be logged out for security reasons.",
"logoutIn": "Log out in ",

View File

@ -18,11 +18,18 @@ export const toasters = {
variant: 'warning',
})
},
toastInfoNoHide(message) {
this.toast(message, {
title: this.$t('navigation.info'),
variant: 'warning',
noAutoHide: true,
})
},
toast(message, options) {
if (message.replace) message = message.replace(/^GraphQL error: /, '')
this.$root.$bvToast.toast(message, {
autoHideDelay: 5000,
appendToast: true,
autoHideDelay: 5000,
solid: true,
toaster: 'b-toaster-top-right',
headerClass: 'gdd-toaster-title',

View File

@ -70,6 +70,8 @@ describe('Community', () => {
lastName: 'Bloxberg',
state: 'IN_PROGRESS',
messagesCount: 0,
deniedAt: null,
deniedBy: null,
},
{
id: 1550,
@ -84,6 +86,8 @@ describe('Community', () => {
lastName: 'Bloxberg',
state: 'CONFIRMED',
messagesCount: 0,
deniedAt: null,
deniedBy: null,
},
],
contributionCount: 1,
@ -112,6 +116,10 @@ describe('Community', () => {
confirmedAt: null,
firstName: 'Bibi',
lastName: 'Bloxberg',
deniedAt: null,
deniedBy: null,
messagesCount: 0,
state: 'IN_PROGRESS',
},
{
id: 1550,
@ -124,7 +132,10 @@ describe('Community', () => {
firstName: 'Bibi',
contributionDate: '2022-06-15T08:47:06.000Z',
lastName: 'Bloxberg',
deniedAt: null,
deniedBy: null,
messagesCount: 0,
state: 'IN_PROGRESS',
},
{
id: 1556,
@ -137,6 +148,10 @@ describe('Community', () => {
confirmedAt: null,
firstName: 'Bob',
lastName: 'der Baumeister',
deniedAt: null,
deniedBy: null,
messagesCount: 0,
state: 'IN_PROGRESS',
},
],
contributionCount: 3,