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

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

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

  ngOnInit() {
    this.loadGameById()
  }

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

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

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


}
