Files
Do-It-Earlier/src/services/base.service.ts
T
2026-09-22 20:32:14 +02:00

18 lines
532 B
TypeScript

import { HttpClient } from '@angular/common/http';
import { inject, Service } from '@angular/core';
import { Observable } from 'rxjs';
@Service()
export class BaseService {
private readonly http: HttpClient = inject(HttpClient);
private readonly baseAddress: string = "http://127.0.0.1:8080/";
protected get<T>(url: string): Observable<T> {
return this.http.get<T>(this.baseAddress + url);
}
protected post<T>(url: string, body: T): Observable<T> {
return this.http.post<T>(this.baseAddress + url, body);
}
}