change api source for mobile

This commit is contained in:
Peter Maquiran
2024-06-02 13:48:01 +01:00
parent c372f7b2b9
commit f38b445bd4
6 changed files with 54 additions and 90 deletions
+11 -7
View File
@@ -1,5 +1,6 @@
import { HttpClient, HttpHeaderResponse, HttpHeaders } from '@angular/common/http';
import { HttpClient, HttpErrorResponse, HttpHeaderResponse, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { ok, err } from 'neverthrow';
import { environment } from 'src/environments/environment';
@Injectable({
@@ -9,16 +10,19 @@ export class HttpService {
constructor(private http:HttpClient) { }
post(serviceName:string, data:any){
const headers = new HttpHeaders();;
const options = {header: headers, withCredentials: false};
async post(serviceName:string, data:any) {
const headers = new HttpHeaders();
const url = environment.apiChatUrl+serviceName;
const body = {"user": "admin","password": "tabteste@006"};
return this.http.post(url, /* JSON.stringify( */data/* ), options */)
try {
const result = await this.http.post(url, {}).toPromise()
return ok (result)
} catch (e) {
return err(e as HttpErrorResponse)
}
}
get(serviceName:string, options:any){
async get(serviceName:string, options:any) {
const url = environment.apiChatUrl+serviceName;
return this.http.get(url, options);
}
+12 -12
View File
@@ -83,21 +83,21 @@ export class ProcessesService {
return this.http.get<fullTaskList[]>(`${geturl}`, options);
}
eventsToApprove(userid, caller) {
const geturl = environment.apiURL + 'tasks/events-to-approve';
let params = new HttpParams();
// eventsToApprove(userid, caller) {
// const geturl = environment.apiURL + 'tasks/events-to-approve';
// let params = new HttpParams();
params = params.set("pageNum", 1);
params = params.set("pageSize", 500);
params = params.set("userid", userid);
// params = params.set("pageNum", 1);
// params = params.set("pageSize", 500);
// params = params.set("userid", userid);
let options = {
headers: this.headers,
params: params
};
// let options = {
// headers: this.headers,
// params: params
// };
return this.http.get<fullTaskList[]>(`${geturl}`, options);
}
// return this.http.get<fullTaskList[]>(`${geturl}`, options);
// }
GetTaskListExpediente(onlycount1): Observable<ExpedienteFullTask[]> {
const processname = "Expediente"