@@ -358,9 +358,11 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
358358
359359 //this.sort.sortChange.subscribe(() => (this.paginator.pageIndex = 0));
360360
361- merge ( this . sort . sortChange , this . paginator . page )
362- . pipe ( tap ( ( ) => this . loadAuditTrailsPage ( ) ) )
363- . subscribe ( ) ;
361+ if ( this . sort && this . paginator ) {
362+ merge ( this . sort . sortChange , this . paginator . page )
363+ . pipe ( tap ( ( ) => this . loadAuditTrailsPage ( ) ) )
364+ . subscribe ( ) ;
365+ }
364366 }
365367
366368 /**
@@ -381,7 +383,7 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
381383 * Loads a page of audit trails.
382384 */
383385 loadAuditTrailsPage ( ) {
384- if ( ! this . sort . direction ) {
386+ if ( this . sort && ! this . sort . direction ) {
385387 delete this . sort . active ;
386388 }
387389 this . getAuditTrails ( ) ;
@@ -393,7 +395,9 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
393395 * @param {string } property Property to filter data by.
394396 */
395397 applyFilter ( filterValue : string , property : string ) {
396- this . paginator . pageIndex = 0 ;
398+ if ( this . paginator ) {
399+ this . paginator . pageIndex = 0 ;
400+ }
397401 const findIndex = this . filterAuditTrailsBy . findIndex ( ( filter ) => filter . type === property ) ;
398402 this . filterAuditTrailsBy [ findIndex ] . value = filterValue ;
399403 this . loadAuditTrailsPage ( ) ;
@@ -544,7 +548,7 @@ export class AuditTrailsComponent implements OnInit, AfterViewInit {
544548 'clientName'
545549 ] ;
546550 this . systemService
547- . getAuditTrails ( this . filterAuditTrailsBy , this . sort . active ? this . sort . active : '' , this . sort . direction , 0 , - 1 )
551+ . getAuditTrails ( this . filterAuditTrailsBy , this . sort ? .active ?? '' , this . sort ? .direction ?? '' , 0 , - 1 )
548552 . subscribe ( ( response : any ) => {
549553 if ( response !== undefined ) {
550554 let csv = response . pageItems . map ( ( row : any ) =>
0 commit comments