parent
7657843bca
commit
25c76aea20
@ -0,0 +1,24 @@
|
|||||||
|
<div class="container mx-auto px-4 py-8">
|
||||||
|
<h1 class="text-3xl font-bold mb-8">Gestion des utilisateurs</h1>
|
||||||
|
|
||||||
|
<div class="bg-white rounded-lg shadow overflow-hidden">
|
||||||
|
<table class="min-w-full divide-y divide-gray-200">
|
||||||
|
<thead class="bg-gray-50">
|
||||||
|
<tr>
|
||||||
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nom d'utilisateur</th>
|
||||||
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Statut</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="bg-white divide-y divide-gray-200">
|
||||||
|
<tr *ngFor="let user of users">
|
||||||
|
<td class="px-6 py-4 whitespace-nowrap">{{ user.username }}</td>
|
||||||
|
<td class="px-6 py-4 whitespace-nowrap">
|
||||||
|
<span [class]="user.is_admin ? 'text-green-600' : 'text-gray-600'">
|
||||||
|
{{ user.is_admin ? 'Administrateur' : 'Utilisateur' }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,37 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { environment } from '../../../environment';
|
||||||
|
|
||||||
|
interface User {
|
||||||
|
_id: string;
|
||||||
|
username: string;
|
||||||
|
is_admin: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-users',
|
||||||
|
templateUrl: './users.component.html',
|
||||||
|
styleUrls: ['./users.component.css'],
|
||||||
|
imports: [CommonModule]
|
||||||
|
})
|
||||||
|
export class UsersComponent implements OnInit {
|
||||||
|
users: User[] = [];
|
||||||
|
|
||||||
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.loadUsers();
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadUsers(): void {
|
||||||
|
this.http.get<User[]>(`${environment.apiURL}/admin/users`).subscribe(
|
||||||
|
users => {
|
||||||
|
this.users = users;
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.error('Erreur lors du chargement des utilisateurs:', error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue