@@ -3,7 +3,6 @@ import { IAuditLogEntry } from "./audit-log";
33import { Store } from "@ngrx/store" ;
44import { AuditLogState } from "./audit-log.reducer" ;
55import * as actions from "./audit-log.actions" ;
6- import { PageChangedEvent } from "ngx-bootstrap/pagination" ;
76
87@Component ( {
98 selector : "app-audit-log-list" ,
@@ -13,8 +12,8 @@ import { PageChangedEvent } from "ngx-bootstrap/pagination";
1312export class AuditLogListComponent implements OnInit {
1413 auditLogs : IAuditLogEntry [ ] = [ ] ;
1514 totalItems : number = 0 ;
16- currentPage : number = 0 ;
17- constructor ( private store : Store < { auditLog : AuditLogState } > ) { }
15+ currentPage : number = 1 ;
16+ constructor ( private store : Store < { auditLog : AuditLogState } > ) { }
1817
1918 ngOnInit ( ) : void {
2019 this . store
@@ -24,17 +23,17 @@ export class AuditLogListComponent implements OnInit {
2423 this . auditLogs = auditLog . auditLogs ;
2524 this . totalItems = auditLog . totalItems ;
2625 } ,
27- error : ( err ) => { } ,
26+ error : ( err ) => { } ,
2827 } ) ;
2928 this . store . dispatch ( actions . fetchAuditLogsStart ( ) ) ;
3029 this . store . dispatch ( actions . fetchAuditLogs ( { page : 1 , pageSize : 5 } ) ) ;
3130 }
3231
33- pageChanged ( event : PageChangedEvent ) : void {
34- if ( this . currentPage !== event . page ) {
32+ pageChanged ( page : number ) : void {
33+ if ( this . currentPage !== page ) {
3534 this . store . dispatch ( actions . fetchAuditLogsStart ( ) ) ;
36- this . store . dispatch ( actions . fetchAuditLogs ( { page : event . page , pageSize : 5 } ) ) ;
37- this . currentPage = event . page ;
35+ this . store . dispatch ( actions . fetchAuditLogs ( { page : page , pageSize : 5 } ) ) ;
36+ this . currentPage = page ;
3837 }
3938 }
4039}
0 commit comments