26 lines
896 B
TypeScript
26 lines
896 B
TypeScript
|
|
import { Injectable } from '@angular/core';
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
import { MessageService } from './message.service';
|
|
import { serviceBaseUrl } from './config';
|
|
|
|
|
|
import { Fee, OverheadAdvance } from './data-objects';
|
|
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class ExtApiService {
|
|
constructor(private messageService: MessageService, private http: HttpClient) { }
|
|
|
|
async getOverheadAdvancesByFlat(id: number): Promise<OverheadAdvance[]> {
|
|
this.messageService.add(`ExtApiService: get overheadadvances by flat ${id}`);
|
|
return this.http.get<OverheadAdvance[]>(`${serviceBaseUrl}/v1/overhead_advances/flat/${id}`).toPromise()
|
|
}
|
|
|
|
async getFeeByTenancies(id: number): Promise<Fee[]> {
|
|
this.messageService.add(`ExtApiService: get fees by flat ${id}`);
|
|
return this.http.get<Fee[]>(`${serviceBaseUrl}/v1/fees/tenancy/${id}`).toPromise()
|
|
}
|
|
}
|