import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { IonRouterOutlet, ModalController } from '@ionic/angular';
import { CloudUser } from 'src/lib/ncloud';

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

  currentUser:CloudUser|undefined
  constructor(
    private router:Router,
    private modalCrtl:ModalController,
    private routerOutlet:IonRouterOutlet
  ) { 
    
    this.currentUser=new CloudUser()
  }
  async login(){
    let user:any=new CloudUser();
    user=await this.currentUser?.login("Clym","1234")
    if(user?.id){
      this.currentUser=user;
      this.router.navigate(['/tabs/tab5']);
    }
  }
  async logout(){
    this.currentUser?.logout();
    this.currentUser=undefined
  }

  ngOnInit() {}
}
