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 = 'https://allowanceplanner.seeseepuff.be/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}`);
    }
}
