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

@Component({
  selector: 'app-music-detail',
  templateUrl: './music-detail.page.html',
  styleUrls: ['./music-detail.page.scss'],
})
export class MusicDetailPage implements OnInit {
  constructor(private route:ActivatedRoute,
    private navCtrl:NavController
  ) { }

  ngOnInit() {
    this.loadMusicById()
  }

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

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

  goToBack()
  {
    this.navCtrl.back();
  }

}
