import { Component, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CompNavComponent } from '../../../app/comp-nav/comp-nav.component';
import { NzPageHeaderModule } from 'ng-zorro-antd/page-header';
import { Router } from '@angular/router';
import { NzInputModule } from 'ng-zorro-antd/input';
import { NzAvatarModule } from 'ng-zorro-antd/avatar';
import { NzButtonModule } from 'ng-zorro-antd/button';
import Parse from 'parse';

@Component({
  selector: 'app-profile',
  templateUrl: './profile.component.html',
  standalone: true,
  imports: [
    CompNavComponent,
    NzPageHeaderModule,
    NzInputModule,
    NzAvatarModule,
    FormsModule,
    NzButtonModule
  ],
  styleUrls: ['./profile.component.scss'],
})
export class ProfileComponent implements OnInit {
  user: Parse.User = Parse.User.current()!;

  editUser: object | any = this.user.toJSON();
  profileList:Array<Parse.Object> = []

  constructor(private router: Router) {}

  ngOnInit() {
    console.log(this.editUser);
    this.getProfile()
  }
  async getProfile(){
    let query = new Parse.Query('Profile')
    query.equalTo('user', this.user.id)
    let r = await query.find()
    this.profileList = r
  }
  onBack(): void {
    history.back();
  }
}
