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

@Component({
  selector: 'app-user-info',
  templateUrl: 'user-info.page.html',
  styleUrls: ['user-info.page.scss'],
})

export class UserInfoPage {
  
  userInfo: any = {};


  ngOnInit() {
    this.getUser()
  }
  currentUser:any
  getUser(){
    this.currentUser = Parse.User.current();
    // this.userInfo = this.currentUser.toJSON();
    console.log(this.currentUser);
    
  }

  save() {
    // const currentUser = Parse.User.current();
    // for (let key in this.userInfo) {
    //   if (this.userInfo.hasOwnProperty(key)) {
    //     this.currentUser.set(key, this.userInfo[key]);
    //   }
    // }
    // this.currentUser.save().then(() => {
    //   // 返回上一页的逻辑
    // }).catch((error: any) => {
    //   console.error('Error saving user info: ', error);
    // });
  }

  cancel() {
    // 返回上一页的逻辑
  }
}