diff --git a/src/app/receipt.service.ts b/src/app/receipt.service.ts index 0460b6f..6cbead0 100644 --- a/src/app/receipt.service.ts +++ b/src/app/receipt.service.ts @@ -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= this._nameUpdated.asObservable(); public readonly ownerUpdate; private reqHeaders: HttpHeaders; + private session: null|string; + private params: HttpParams; - constructor( + 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) {