| 123456789101112131415161718192021222324252627 |
- import { Injectable } from '@angular/core';
- import { environments } from '../../../../environments/environments';
- import { HttpClient, HttpHeaders } from '@angular/common/http';
- @Injectable({
- providedIn: 'root'
- })
- export class TareasService {
- 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}`
- });
- }
- getTareas(idAlumno: string) {
- return this.http.get(`${this.URL}/tareas/usuario/${idAlumno}`, { headers: this.getHeaders() });
- }
- }
|