import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { Allowance } from '../models/allowance'; @Injectable({ providedIn: 'root' }) export class AllowanceService { private url = 'http://localhost:8080/api'; constructor(private http: HttpClient) {} getAllowanceList(userId: number): Observable> { return this.http.get(`${this.url}/user/${userId}/allowance`); } getAllowanceById(allowanceId: number, userId: number): Observable { return this.http.get(`${this.url}/user/${userId}/allowance/${allowanceId}`); } createAllowance(allowance: Partial, userId: number) { this.http.post(`${this.url}/user/${userId}/allowance`, allowance).subscribe(); } updateAllowance(allowance: Partial, allowanceId: number, userId: number) { this.http.put(`${this.url}/user/${userId}/allowance/${allowanceId}`, allowance).subscribe(); } }