generated from nhcarrigan/template
30 lines
693 B
TypeScript
30 lines
693 B
TypeScript
/**
|
|
* @copyright 2026 NHCarrigan
|
|
* @license Naomi's Public License
|
|
* @author Naomi Carrigan
|
|
*/
|
|
|
|
import { Injectable, inject } from '@angular/core';
|
|
import { Observable } from 'rxjs';
|
|
import { ApiService } from './api.service';
|
|
import { User } from '@library/shared-types';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class UserService {
|
|
private api = inject(ApiService);
|
|
|
|
getAllUsers(): Observable<User[]> {
|
|
return this.api.get<User[]>('/users');
|
|
}
|
|
|
|
banUser(userId: string): Observable<User> {
|
|
return this.api.post<User>(`/users/${userId}/ban`, {});
|
|
}
|
|
|
|
unbanUser(userId: string): Observable<User> {
|
|
return this.api.post<User>(`/users/${userId}/unban`, {});
|
|
}
|
|
}
|