import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { handleError } from '../../shared/utilities/utils'; import { catchError } from 'rxjs/operators'; import { USER_DETAILS_API } from 'src/constants/apiConstants'; import { CookieService } from 'ngx-cookie-service'; @Injectable({ providedIn: 'root' }) export class GenerateLetterService { userInfo={ empId : '', gender :'', location : '', department :'', grade : '', displayName : '', userMobile : '', mailId : '' }; constructor(private http: HttpClient, private cookieService: CookieService) { } getUserDetailsFromCookies(){ this.userInfo.empId = this.cookieService.get('empId'); this.userInfo.gender = this.cookieService.get('Gender'); this.userInfo.location = this.cookieService.get('empLocationText'); this.userInfo.department = this.cookieService.get('department'); this.userInfo.grade = this.cookieService.get('_ga'); this.userInfo.displayName = this.cookieService.get('displayName'); this.userInfo.userMobile = this.cookieService.get('userMobile'); this.userInfo.mailId = this.cookieService.get('mailId'); } getUserObject(){ return this.userInfo; } getUserDetails(body: any) { let response; try { const saveURL = USER_DETAILS_API; response = this.http.post(saveURL, body).pipe(catchError(handleError())); } catch (error) { response = error; } return response; } sendMail(){ } }