Files
mowesta/web-angular/src/app/services/stations.service.ts
T
handte e984113e22
LocationBasedServices/mowesta/master This commit looks good
Improved webapp, still incomplete.
2020-03-08 22:17:34 +01:00

33 lines
907 B
TypeScript

import { Injectable } from '@angular/core';
import { AbstractPageService } from '../utils';
import { DefaultService, WeatherStation, WeatherStationPage } from '../api';
import { Observable } from 'rxjs';
import { HttpResponse } from '@angular/common/http';
/**
* A service that retrieves a page of weather stations.
*/
@Injectable()
export class StationsService extends AbstractPageService<WeatherStation, WeatherStationPage> {
term = '';
constructor(apiClientService: DefaultService) {
super(apiClientService);
}
protected loadPage(offset: number, size: number): Observable<HttpResponse<WeatherStationPage>> {
return this.apiClientService.getStations(this.term, offset, size, 'response');
}
setTerm(term: string) {
this.term = term;
this.getPage(0, this.page.getValue().size);
}
getTerm(): string {
return this.term;
}
}