import { Injectable } from '@angular/core';
import { HttpHeaders, HttpClient } from '@angular/common/http';
import { environment } from '../../environments/environment';
@Injectable({ providedIn: 'root' })
export class ChangePasswordService {
  baseUrl: string;
  constructor(private http: HttpClient) { }
  checkoldpassword(password: string, username: string) {
    this.baseUrl = environment.serviceUrl;
    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.http.post(this.baseUrl + 'api/UserApi/checkoldpassword', { password, username }, { headers: header, observe: 'response' });
  }
  changepassword(password: string, userid: number) {
    this.baseUrl = environment.serviceUrl;
    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.http.post(this.baseUrl + 'api/UserApi/changepassword', { password, userid }, { headers: header, observe: 'response' });
  }
}
