import { NgxSpinnerService } from 'ngx-spinner';
import { AuthServiceService } from './../../shared/auth-service.service';
import { ActivatedRoute, Params } from '@angular/router';
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';

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

  constructor(private route: ActivatedRoute, 
    private http: HttpClient,
    private spinner: NgxSpinnerService,
    private authSer:AuthServiceService) { }

  policyId: number;
  data = [];

  ngOnInit() {

    this.spinner.show();
    this.authSer.homeActivate = false;
    this.route.params.subscribe(
      (params: Params) => {
        this.policyId = params['policyId'];
        this.data = [];
        this.http.get(this.authSer.pathApi + '/get_footer/' + this.policyId).subscribe(
          (responce) => {
            this.data = responce['footer'];
            console.log(this.data);
            this.spinner.hide();
          },
          (error) => {
            console.log(error);
          }
        );
      }
    );
  }

}
