import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import Parse from "parse";

@Component({
  selector: 'app-case-pet-detail',
  templateUrl: './case-pet-detail.page.html',
  styleUrls: ['./case-pet-detail.page.scss'],
})
export class CasePetDetailPage implements OnInit {

  constructor(private route:ActivatedRoute) { }

  ngOnInit() {
    this.loadDelicacyById()
  }

  Delicacy:Parse.Object|undefined

  async loadDelicacyById(){
    // let id = location.pathname.split("/").pop();
    let id = this.route.snapshot.params["id"]

    if(id){
      let query = new Parse.Query("Delicacy");
      query.include("locationimage"); // 包含 locationimage 字段
      query.include("foodimage"); // 包含 foodimage 字段
      this.Delicacy = await query.get(id);
    }
  }

}
