import { Injectable } from '@angular/core';
 
import { HttpClient } from '@angular/common/http';
 
import { BehaviorSubject, Observable, of } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { environment } from '../../environments/environment';
 
@Injectable({
  providedIn: 'root'
})
export class PageapiService {
  public orderDetails:BehaviorSubject<any> = new BehaviorSubject<any>([]);
public orderDetails_observable$ = this.orderDetails.asObservable();
  private apiUrl = environment.apiEndpoint;
  constructor(private _http: HttpClient) { } 

  getusers(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getusers",param)
   
  }
  getProducts(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getProducts",param)
   
  }

  getOrders(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getOrders",param)
   
  }
  addUserFormDetails(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'createUsers', addParams)
     
  }
  CreateCustomersDetails(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'CreateCustomers', addParams)
     
  }

  CreateProductDetails(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'CreateProducts', addParams)
     
  }
  CreateOrder(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'CreateOrder', addParams)
     
  }
  
  
}

