TD-4: Bannen wip
All checks were successful
Quality Check / Linting (push) Successful in 23s
All checks were successful
Quality Check / Linting (push) Successful in 23s
This commit is contained in:
parent
dcaa8f0939
commit
acc1dc9bea
4 changed files with 11 additions and 5 deletions
3
src/app/core/auth/UserData.d.ts
vendored
3
src/app/core/auth/UserData.d.ts
vendored
|
@ -1,6 +1,7 @@
|
|||
interface UserData {
|
||||
username: string,
|
||||
verified: boolean
|
||||
verified: boolean,
|
||||
id: number
|
||||
}
|
||||
|
||||
export default UserData;
|
||||
|
|
|
@ -22,7 +22,8 @@ export class AuthService implements CanActivate {
|
|||
const isLoggedIn = isAuthenticated && userData != null && accessToken != '';
|
||||
this.$user.next(isLoggedIn ? {
|
||||
username: userData.preferred_username,
|
||||
verified: userData.email_verified
|
||||
verified: userData.email_verified,
|
||||
id: userData.id
|
||||
} : undefined);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
<th mat-header-cell *matHeaderCellDef>Username</th>
|
||||
<td mat-cell *matCellDef="let user"> {{ user.username }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="banned">
|
||||
<th mat-header-cell *matHeaderCellDef>Is banned</th>
|
||||
<td mat-cell *matCellDef="let user"> {{ user.banned }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
||||
<td mat-cell *matCellDef="let user">
|
||||
|
|
|
@ -28,7 +28,7 @@ import {AdministratablePlayer, AdminService, PlayerFilter} from '@core/server';
|
|||
styleUrl: './dashboard.component.scss'
|
||||
})
|
||||
export class DashboardComponent implements OnInit {
|
||||
displayedColumns: Array<string> = ['username', 'actions'];
|
||||
displayedColumns: Array<string> = ['username', 'actions', 'banned'];
|
||||
usersDataSource: MatTableDataSource<AdministratablePlayer> = new MatTableDataSource<AdministratablePlayer>([]);
|
||||
|
||||
constructor(private adminService: AdminService, protected authService: AuthService) {
|
||||
|
@ -63,8 +63,8 @@ export class DashboardComponent implements OnInit {
|
|||
|
||||
banPlayer(user: UserData): void {
|
||||
console.log(`Banning user: ${user.username}`);
|
||||
// TODO: implement banning logic
|
||||
this.adminService.banPlayer();
|
||||
this.adminService.banPlayer(user.id);
|
||||
this.fetchPlayers('');
|
||||
}
|
||||
|
||||
onSearch(searchbar: HTMLInputElement): void {
|
||||
|
|
Loading…
Add table
Reference in a new issue