import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { environment } from '../../../environments/environment';
@Injectable({
  providedIn: 'root'
})
export class UseraddService {
  baseUrl: string = environment.serviceUrl;
  constructor(private httpClient: HttpClient) {
  }

  GetRequesttype(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/UserApi/GetRequesttype/');
  }

  GetMailid(maild) {
    return this.httpClient.get(this.baseUrl + 'api/UserApi/FindByMailId_User?mailid=' + maild)
  }

  GetImage(filename: string): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/UserApi/GetIcon/' + filename, { observe: 'response' });
  }
  GetById(userid: number) {
    return this.httpClient.get<any>(this.baseUrl + 'api/UserApi/GetByUserId/' + userid);
  }

  Post(formdata: FormData) {
    return this.httpClient.post(this.baseUrl + 'api/UserApi/add', formdata, { observe: 'response' })
  }
  Put(formdata: FormData) {
    return this.httpClient.post(this.baseUrl + 'api/UserApi/Update', formdata, { observe: 'response' })
  }
}

