Enhance receipt service for new API
This commit is contained in:
parent
040fc22e69
commit
624fbf27e8
1 changed files with 9 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Subject, BehaviorSubject, Observable } from 'rxjs';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
||||
import { Order } from './order/order.model';
|
||||
import { Owner } from './owner.model';
|
||||
|
@ -69,19 +69,22 @@ export class ReceiptService {
|
|||
public readonly nameUpdate: Observable<string>= this._nameUpdated.asObservable();
|
||||
public readonly ownerUpdate;
|
||||
private reqHeaders: HttpHeaders;
|
||||
private session: null|string;
|
||||
private params: HttpParams;
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
public userService: UserService
|
||||
) {
|
||||
this.session = localStorage.getItem('s4z_token');
|
||||
this.params = new HttpParams().append('session', this.session!);
|
||||
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
||||
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
||||
this.ownerUpdate = userService.ownerUpdate;
|
||||
}
|
||||
|
||||
getOrderById(id:string) {
|
||||
//const params = new HttpParams().append('id', id);
|
||||
let obs = this.http.get<{message: string, order: any}>(this.beUrl+'api/order/'+id, { headers:this.reqHeaders, observe: 'response'});
|
||||
let obs = this.http.get<{message: string, order: any}>(this.beUrl+'api/order/'+id, { headers:this.reqHeaders, params: this.params, observe: 'response'});
|
||||
|
||||
obs.subscribe((OrderDataResponse) => {
|
||||
if (OrderDataResponse.status == 200) {
|
||||
|
|
Loading…
Reference in a new issue