Hi,
somehow I’ve got some problems with Alerts
.
Scenario
A user is logged in to a server. When he’s going to logout, an event is gone to be fired:
LocalStorage.remove('private_access_token')
Events.$emit('logout', {
loggedIn: false
})
So far so good. Everthing works fine.
In my Layout.vue
file the event handler does its work:
Events.$on('logout', response => {
// some logic
this.showLogoutAlert()
})
The function showLogoutAlert()
does the following:
showLogoutAlert () {
Alert.create({
enter: 'bounceInRight',
leave: 'bounceOutRight',
color: 'positive',
icon: 'lock',
html: `Sie wurden erfolgreich abgemeldet`,
position: 'top-right'
})
}
In another part of the code, another event is fired, when a user changes the password:
Events.$emit('passwordChange', {
showModal: false
})
The event handler does following:
Events.$on('passwordChange', response => {
this.showPasswordModal = response.showModal
this.showPassChangedAlert()
})
And the function showPassChangedAlert()
contains the following code:
showPassChangedAlert () {
Alert.create({
enter: 'bounceInRight',
leave: 'bounceOutRight',
color: 'positive',
icon: 'update',
html: `Das Passwort wurde geändert`,
position: 'top-right'
})
}
The Problem
When the user is logged out. The alert appears. The little cross is tabbed and the alert disappears. Great!
But when the user does another login and goes to change the password, then the alert for the password change and the previous logout-alert show.
I really have no idea, why this is happening. May someone can help me please?
Thank you for your time.
Michael