Aw-5739 Add data download service
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
parent
5714cdce72
commit
ce2f06091b
@ -18,6 +18,7 @@ import { EventService } from './services/event.service';
|
||||
import { TypeaheadService } from './services/typeahead.service';
|
||||
import { UserService } from './services/user.service';
|
||||
import { ImageService } from './services/image.service';
|
||||
import { DownloadService } from './services/download.service';
|
||||
import { GeolocatorService } from './services/geolocator.service';
|
||||
import { WeatherService} from './services/weather.service';
|
||||
import { AppConfig } from './shared/app.config';
|
||||
@ -48,6 +49,7 @@ export {
|
||||
TypeaheadService,
|
||||
UserService,
|
||||
ImageService,
|
||||
DownloadService,
|
||||
GeolocatorService,
|
||||
WeatherService,
|
||||
AppConfig,
|
||||
|
29
projects/common/src/fm/services/download.service.ts
Normal file
29
projects/common/src/fm/services/download.service.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { IItem } from '../models/item';
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { AppConfig } from "../shared/app.config";
|
||||
import {ItemTypeService} from './itemtype.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DownloadService {
|
||||
constructor(public httpClient: HttpClient, public appConfig: AppConfig,private itemTypeService:ItemTypeService) {
|
||||
}
|
||||
|
||||
ApiEndpoint() {
|
||||
return this.appConfig.getConfig("apiEndPoint");
|
||||
}
|
||||
|
||||
getData(itemCode: string): Observable<any> {
|
||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/data`);
|
||||
}
|
||||
|
||||
getData2(item: IItem): Observable<any> {
|
||||
if (item.size > 0) {
|
||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/data`)
|
||||
}
|
||||
return of({});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user