webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

Listening for Authentication status change in AgileApps CUI template 

Fri September 03, 2021 01:48 AM

Following authentication status events are available in a CUI template
  1. AceEventAuthenticated (dispatched upon successful login event)
  2. AceEventUnauthenticated (dispatched upon logout/session time out event)

Listening for these events will help performing specific actions on CUI template.

Using native JavaScript way to listen for these events

<script type="text/javascript">
window.addEventListener('load', () => {
document.body.addEventListener('AceEventAuthenticated', () => {
// navigate to application main content
});
document.body.addEventListener('AceEventUnauthenticated', () => {
// navigate to login page
});
});
</script>

If you are using Angular framework, use the following code sample

import { Component, Inject, OnInit } from '@angular/core';
import { DOCUMENT } from '@angular/common';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
constructor(@Inject(DOCUMENT) private document: Document) {}
ngOnInit(): void {
this.document.body.addEventListener('AceEventAuthenticated', () => {
// navigate to application main content
});
this.document.body.addEventListener('AceEventUnauthenticated', () => {
// navigate to login page
});

}
}

#Template-Events
#webMethods
#AgileApps

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads