setup usersa
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user