setup usersa

This commit is contained in:
2025-05-14 15:40:14 +02:00
parent 2486bbf1ec
commit df1b8e4ed7
40 changed files with 221 additions and 57 deletions

View File

@@ -0,0 +1,20 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { User } from '../models/user';
@Injectable({
providedIn: 'root',
})
export class UserService {
private url = 'localhost:59772/api';
constructor(private http: HttpClient) {}
getUserList(): Observable<Array<User>> {
return this.http.get<User[]>(`${this.url}/users`);
}
getUserById(id: number): Observable<User> {
return this.http.get<User>(`${this.url}/user/${id}`);
}
}