import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environments } from '../../../../environments/environments';
import { Personalizar } from '../interfaces/Personalizar.interface';

@Injectable({
  providedIn: 'root'
})
export class PersonalizarService {
  private URL: string = environments.baseUrl;
  constructor(private http: HttpClient) { }
  private getHeaders(): HttpHeaders {
    const token = localStorage.getItem('token') || '';
    return new HttpHeaders({
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${token}`
    });
  }
  getOptions() {
    return this.http.get(`${this.URL}/personalizarInfo`);
  }

  personalizar(personalizar: Personalizar) {
    return this.http.put(`${this.URL}/personalizar`, personalizar, { headers: this.getHeaders() });
  }
}
