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

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

  constructor(private route:ActivatedRoute,
    private navCtrl:NavController
  ) { }

  ngOnInit() {
    this.loadOutdoorById()
  }

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

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

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


}
