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

@Injectable({
  providedIn: 'root'
})
export class BitacoraService {
  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}`
    });
  }
  getByUser(id: string) {
    let qId = btoa(id);
    return this.http.get(`${this.URL}/getByUser/${qId}`, { headers: this.getHeaders() });

  }


  verBitacora(data: any) {
    return this.http.post(`${this.URL}/alumnos/bitacora/visto`, data, { headers: this.getHeaders() });
  }
   getOne(id: string) {
    let qId = btoa(id);
    return this.http.get(`${this.URL}/UserOne/${qId}`, { headers: this.getHeaders() });
  }
}
