import { Component, OnInit } from '@angular/core';
import { HitAWodService } from 'src/app/services/hit-a-wod.service';
import { ActivatedRoute } from '@angular/router';

@Component({
  selector: 'app-legal',
  templateUrl: './legal.component.html',
  styleUrls: ['./legal.component.css']
})
export class LegalComponent implements OnInit {

  terminos:any;
  aviso_legal:any;
  politica:any;

  constructor(private api: HitAWodService,
              private activatedRoute: ActivatedRoute) { }

  ngOnInit(): void {
    const company_id = this.activatedRoute.snapshot.queryParamMap.get('company_id');

    if (company_id) {
      this.api.getAvisoLegalCompletoAtleta(company_id).subscribe( p => {
        this.aviso_legal = p.data;
      });
    } else {
      this.api.getAvisoLegalCompleto().subscribe( p => {
        this.aviso_legal = p.data;
      });
    }
    this.api.getTerminosCondiciones().subscribe( p => {
      this.terminos = p.data;
    });
    this.api.getPoliticaPrivacitat().subscribe( p => {
      this.politica = p.data;
    });
  }

}
