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 AuthService {
  private apiUrl = environment.apiEndpoint;
  constructor(private _http: HttpClient) { } 

  update_token(params): Observable<any> {
    console.log(params.id)
     return this._http.post<any>(this.apiUrl + "updateToken",params)
  }

  getLoginToken(params): Observable<any> {
    console.log(params.email)
    return this._http.post<any>(this.apiUrl + "login",{'email':params.email,'password':params.password})
   
  }

  getForgotToken(params): Observable<any> {
    console.log(params.email)
    return this._http.post<any>(this.apiUrl + "_api",{'email':params.email,'password':params.password})
   
  }


  verifyOtp(params): Observable<any> {
    console.log(params.email)
    return this._http.post<any>(this.apiUrl + "otp-verify",params)
   
  }
  resetPasswordApi(params): Observable<any> {
   // console.log(params.email)
    return this._http.post<any>(this.apiUrl + "reset-password",params)
   
  }
  
  
}
