mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
toast by automatically logged out
This commit is contained in:
parent
36e8e2c38d
commit
c4fae48b1d
@ -67,6 +67,7 @@ export default {
|
||||
}
|
||||
if (this.tokenExpiresInSeconds === 0) {
|
||||
this.$timer.stop('tokenExpires')
|
||||
this.$store.commit('automaticallyLoggedOut', true)
|
||||
this.$emit('logout')
|
||||
}
|
||||
},
|
||||
@ -84,6 +85,7 @@ export default {
|
||||
})
|
||||
.catch(() => {
|
||||
this.$timer.stop('tokenExpires')
|
||||
this.$store.commit('automaticallyLoggedOut', true)
|
||||
this.$emit('logout')
|
||||
})
|
||||
},
|
||||
|
||||
@ -4,24 +4,33 @@ export const toasters = {
|
||||
this.toast(message, {
|
||||
title: this.$t('success'),
|
||||
variant: 'success',
|
||||
autoHideDelay: 5000,
|
||||
})
|
||||
},
|
||||
toastError(message) {
|
||||
this.toast(message, {
|
||||
title: this.$t('error.error'),
|
||||
variant: 'danger',
|
||||
autoHideDelay: 5000,
|
||||
})
|
||||
},
|
||||
toastInfo(message) {
|
||||
this.toast(message, {
|
||||
title: this.$t('navigation.info'),
|
||||
variant: 'warning',
|
||||
autoHideDelay: 5000,
|
||||
})
|
||||
},
|
||||
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,
|
||||
solid: true,
|
||||
toaster: 'b-toaster-top-right',
|
||||
|
||||
@ -123,5 +123,11 @@ export default {
|
||||
return !this.showPageMessage
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (this.$store.state.automaticallyLoggedOut) {
|
||||
this.toastInfoNoHide('Du wurdest automatisch abgemeldet')
|
||||
this.$store.commit('automaticallyLoggedOut', false)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -53,6 +53,9 @@ export const mutations = {
|
||||
hideAmountGDT: (state, hideAmountGDT) => {
|
||||
state.hideAmountGDT = !!hideAmountGDT
|
||||
},
|
||||
automaticallyLoggedOut: (state, automaticallyLoggedOut) => {
|
||||
state.automaticallyLoggedOut = !!automaticallyLoggedOut
|
||||
},
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
@ -68,6 +71,7 @@ export const actions = {
|
||||
commit('isAdmin', data.isAdmin)
|
||||
commit('hideAmountGDD', data.hideAmountGDD)
|
||||
commit('hideAmountGDT', data.hideAmountGDT)
|
||||
commit('automaticallyLoggedOut', false)
|
||||
},
|
||||
logout: ({ commit, state }) => {
|
||||
commit('token', null)
|
||||
@ -108,6 +112,7 @@ try {
|
||||
publisherId: null,
|
||||
hideAmountGDD: null,
|
||||
hideAmountGDT: null,
|
||||
automaticallyLoggedOut: false,
|
||||
},
|
||||
getters: {},
|
||||
// Syncronous mutation of the state
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user