-import { Component } from '@angular/core'
+import { Component, OnInit } from '@angular/core'
import { NotificationsService } from 'angular2-notifications'
import { SortMeta } from 'primeng/components/common/sortmeta'
templateUrl: './user-list.component.html',
styleUrls: [ './user-list.component.scss' ]
})
-export class UserListComponent extends RestTable {
+export class UserListComponent extends RestTable implements OnInit {
users: User[] = []
totalRecords = 0
rowsPerPage = 10
- sort: SortMeta = { field: 'id', order: 1 }
+ sort: SortMeta = { field: 'createdAt', order: 1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
constructor (
super()
}
+ ngOnInit () {
+ this.loadSort()
+ }
+
async removeUser (user: User) {
if (user.username === 'root') {
this.notificationsService.error('Error', 'You cannot delete root.')
}
getRouterUserEditLink (user: User) {
- return [ '/admin', 'users', user.id, 'update' ]
+ return [ '/admin', 'users', 'update', user.id ]
}
protected loadData () {