import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { PassportService } from '../../services/passport.service';

@Component({
  selector: 'app-buyer-components-serve-order-agreement',
  templateUrl: './order-agreement.component.html',
  styleUrls: ['./order-agreement.component.less']
})
export class OrderAgreementComponent implements OnInit {
  agreementContent: any;
  type = 2;
  constructor(private ar: ActivatedRoute, private service: PassportService) {
    ar.queryParams.subscribe((params: Params) => {
      this.type = params.type || 2;
    });
  }
  ngOnInit() {
    this.service.request(this.service.$api_get_agreement, { type: this.type }).subscribe(res => {
      if (res) {
        console.log(res);
        this.agreementContent = res;
      }
    });
  }
}
