30 lines
880 B
TypeScript
30 lines
880 B
TypeScript
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({});
|
|
}
|
|
}
|