authentication
This commit is contained in:
26
client/src/app/shared/api.service.ts
Normal file
26
client/src/app/shared/api.service.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { IUser } from '../model/interface/user.interface';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ApiService {
|
||||
private http: HttpClient = inject(HttpClient);
|
||||
|
||||
constructor() { }
|
||||
|
||||
|
||||
getAllUsers(): Observable<IUser[]> {
|
||||
return this.http.get<IUser[]>('/api/user');
|
||||
}
|
||||
|
||||
saveUser(user: IUser) {
|
||||
return this.http.post('/api/user', user);
|
||||
}
|
||||
|
||||
getRoles(): Observable<{id: string, name: string}[]> {
|
||||
return this.http.get<{id: string, name: string}[]>('/api/role');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user