import { Component } from '@angular/core';

// 引入服务
import { ActivatedRoute } from '@angular/router';

// 引入Parse第三方库
import * as Parse from "parse"
(Parse as any).serverURL = "http://web2023.fmode.cn:9999/parse"
Parse.initialize("dev")


@Component({
  selector: 'app-attention-detail',
  templateUrl: './attention-detail.component.html',
  styleUrls: ['./attention-detail.component.scss']
})
export class AttentionDetailComponent {

  //添加评论
  comments: string[] = [];
  comment: string = '';
  currentDate = new Date();
  addComment() {
    console.log(this.comment)
    if (this.comment.trim() !== '') {
      this.comments.push(this.comment);
      this.comment = '';
    }
  }

  attention: Parse.Object | undefined;
  constructor(private router: ActivatedRoute) {
    this.router.queryParams.subscribe(param => {
      this.getRoleInfoById(param["id"])
    })
  }
  async getRoleInfoById(id: string) {
    let query = new Parse.Query("PetAttention")
    this.attention = await query.get(id)
  }

}
