import { Component, OnInit } from '@angular/core';
import { NavController } from '@ionic/angular';
import { Location } from '@angular/common';
import { ActivatedRoute } from '@angular/router';
import Parse from "parse";
@Component({
  selector: 'app-detail-page',
  templateUrl: './detail-page.page.html',
  styleUrls: ['./detail-page.page.scss'],
})
export class DetailPagePage implements OnInit {

  
  poem = {  
    title: '',  
    dynasty: '',  
    author: '',  
    content: `  
     
    `,  
    intro: '',  
    translation: '',  
    appreciation: ''  
  };  
  constructor(private navCtrl: NavController,private location:Location,
    private route:ActivatedRoute
  ) { }

  ngOnInit() {
    this.loadShigeById()
  }


  shige:Parse.Object|undefined
  async loadShigeById(){
    let id = this.route.snapshot.params["id"]
    console.log("loadShigeById")
    // let id = location.pathname.split("/").pop();

    if(id){
      let query = new Parse.Query("Shige");
      this.shige = await query.get(id);
    }
  }


  goBack() {  
    
    this.location.back()
  }

  }


