Browse Source

Refactoring

pull/4092/head
Thomas Kaul 9 months ago
parent
commit
e23cca38c9
  1. 14
      apps/client/src/app/components/admin-users/admin-users.component.ts
  2. 2
      apps/client/src/app/components/admin-users/admin-users.module.ts

14
apps/client/src/app/components/admin-users/admin-users.component.ts

@ -149,16 +149,17 @@ export class AdminUsersComponent implements OnDestroy, OnInit {
window.location.reload(); window.location.reload();
} }
public ngOnDestroy() {
this.unsubscribeSubject.next();
this.unsubscribeSubject.complete();
}
public onChangePage(page: PageEvent) { public onChangePage(page: PageEvent) {
this.fetchUsers({ this.fetchUsers({
pageIndex: page.pageIndex pageIndex: page.pageIndex
}); });
} }
public ngOnDestroy() {
this.unsubscribeSubject.next();
this.unsubscribeSubject.complete();
}
private fetchUsers({ pageIndex }: { pageIndex: number } = { pageIndex: 0 }) { private fetchUsers({ pageIndex }: { pageIndex: number } = { pageIndex: 0 }) {
this.isLoading = true; this.isLoading = true;
@ -173,9 +174,8 @@ export class AdminUsersComponent implements OnDestroy, OnInit {
}) })
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ count, users }) => { .subscribe(({ count, users }) => {
this.totalItems = count;
this.dataSource = new MatTableDataSource(users); this.dataSource = new MatTableDataSource(users);
this.totalItems = count;
this.isLoading = false; this.isLoading = false;

2
apps/client/src/app/components/admin-users/admin-users.module.ts

@ -20,8 +20,8 @@ import { AdminUsersComponent } from './admin-users.component';
GfValueComponent, GfValueComponent,
MatButtonModule, MatButtonModule,
MatMenuModule, MatMenuModule,
MatTableModule,
MatPaginatorModule, MatPaginatorModule,
MatTableModule,
NgxSkeletonLoaderModule NgxSkeletonLoaderModule
], ],
schemas: [CUSTOM_ELEMENTS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA]

Loading…
Cancel
Save