All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import {Injectable} from '@angular/core';
|
|
import {HttpClient, HttpParams} from '@angular/common/http';
|
|
import {AppConfig} from '../shared/app.config';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class TaskService {
|
|
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
|
|
}
|
|
|
|
ApiEndpoint() {
|
|
return this.appConfig.getConfig("apiEndPoint");
|
|
}
|
|
|
|
getTask(taskCode: string) {
|
|
return this.httpClient.get<any>(`${this.appConfig.getConfig('apiEndPoint')}/api/v1/tasks/${taskCode}`)
|
|
}
|
|
|
|
getTasks(workflowCode: string, itemCode: string = null, taskType: string = null, skip = 0, take = 25) {
|
|
let params = new HttpParams();
|
|
|
|
if (workflowCode) {
|
|
params = params.append('workflowCode', workflowCode);
|
|
}
|
|
|
|
if (itemCode) {
|
|
params = params.append('itemCode', itemCode);
|
|
}
|
|
|
|
if (taskType) {
|
|
params = params.append('taskType', taskType);
|
|
}
|
|
|
|
params = params.append('skip', skip.toString());
|
|
params = params.append('take', take.toString());
|
|
return this.httpClient.get<any>(`${this.appConfig.getConfig('apiEndPoint')}/api/v1/tasks`,
|
|
{params: params})
|
|
}
|
|
}
|