import { Component } from '@angular/core';
import * as Parse from "parse";

@Component({
  selector: 'app-page-user',
  templateUrl: './page-user.component.html',
  styleUrls: ['./page-user.component.scss']
})
export class PageUserComponent {
  currentUser: Parse.User | undefined
  profile: Parse.Object | undefined
  constructor() {
    this.currentUser = Parse.User.current();
    this.loadProfile()
  }
  async loadProfile() {
    let query = new Parse.Query("Profile")
    query.equalTo("user", this.currentUser?.toPointer())
    query.include("schoolClass") // SELECT * FROM "Profile" LEFT JOIN "Department" ON "Profile"."schoolClass"="Department"."objectId";
    this.profile = await query.first();
    console.log(this.profile?.toJSON())
  }
}
