authentication

This commit is contained in:
Bastian Wagner
2024-09-13 21:14:09 +02:00
parent c00aad559d
commit b4a5f04505
65 changed files with 1140 additions and 77 deletions

View 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');
}
}