import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { UserService } from '../service-user/user.service';
import * as Parse from "parse";
@Component({
  selector: 'app-page-info',
  templateUrl: './page-info.component.html',
  styleUrls: ['./page-info.component.scss']
})
export class PageInfoComponent {
  constructor(
    public userServ: UserService,
    private router: Router
  ) {
    this.userInfo = Parse.User.current()?.toJSON();
  }
  userInfo: any = {}
  async saveInfo() {
    let user = Parse.User.current();
    console.log(this.userInfo)
    delete this.userInfo.objectId
    delete this.userInfo.username
    delete this.userInfo.sessionToken
    delete this.userInfo.updatedAt

    user?.set(this.userInfo)
    await user?.save()
    this.router.navigate(["/lesson/me"])

  }
}

