Update
This commit is contained in:
parent
970ece5602
commit
45a94c99fc
@ -101,7 +101,7 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
{
|
||||
// Fetch all users excluding those with roles SuperAdmin or SystemAdmin
|
||||
var allUsers = await _authDbContext.Users
|
||||
.Include(u => u.Department)
|
||||
.Include(u => u.Department).ThenInclude(d => d!.Company)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var u in allUsers)
|
||||
@ -115,7 +115,7 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
}
|
||||
else
|
||||
{
|
||||
userInfo = await _authDbContext.Users.Include(u => u.Department).ToListAsync();
|
||||
userInfo = await _authDbContext.Users.Include(u => u.Department).ThenInclude(d => d!.Company).ToListAsync();
|
||||
}
|
||||
|
||||
return Ok(new { UserInfo = userInfo });
|
||||
|
||||
@ -72,9 +72,7 @@
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.length > 0) {
|
||||
this.userList = data.length ? data : [];
|
||||
}
|
||||
this.userList = data.userInfo.length ? data.userInfo : [];
|
||||
this.initiateTable();
|
||||
})
|
||||
.catch(error => {
|
||||
@ -121,8 +119,9 @@
|
||||
},
|
||||
initiateTable() {
|
||||
self = this;
|
||||
console.log(self.userList)
|
||||
this.itemDatatable = $('#userDatatable').DataTable({
|
||||
"data": this.userList,
|
||||
"data": self.userList,
|
||||
"columns": [
|
||||
{
|
||||
"title": "UID",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user