be5f5775ef
- ng update @angular/core@20 @angular/cli@20 @angular/material@20 @angular-eslint@20 @angular/google-maps@20 - Remove ng-chartist (abandoned, incompatible with Angular 20): replace <x-chartist> with <app-bars-chart> in dropzones-bar and jumps-by-month - Migrate all constructor injection to inject() function (ng generate @angular/core:inject, 67 files) - TypeScript 5.5 → 5.9.3 - DOCUMENT import moved from @angular/common to @angular/core (automatic migration) - tsconfig moduleResolution updated to "bundler"
30 lines
925 B
TypeScript
30 lines
925 B
TypeScript
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
import { Injectable, inject } from '@angular/core';
|
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
import { Observable } from 'rxjs';
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class ApiService {
|
|
private http = inject(HttpClient);
|
|
|
|
/*private formatErrors(error: any) {
|
|
return throwError(error.error);
|
|
}*/
|
|
|
|
get(path: string, params: HttpParams = new HttpParams()): Observable<any> {
|
|
return this.http.get(`${path}`, { params });
|
|
}
|
|
|
|
put(path: string, body: NonNullable<unknown> = {}): Observable<any> {
|
|
return this.http.put(`${path}`, JSON.stringify(body));
|
|
}
|
|
|
|
post(path: string, body: NonNullable<unknown> = {}): Observable<any> {
|
|
return this.http.post(`${path}`, JSON.stringify(body));
|
|
}
|
|
|
|
delete(path: string): Observable<any> {
|
|
return this.http.delete(`${path}`);
|
|
}
|
|
}
|