import { OnInit } from '@angular/core'; import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { IonHeader, IonToolbar, IonTitle, IonContent, IonCard, IonCardContent, IonButton, IonCardHeader, IonCardTitle, IonCardSubtitle, ModalController, IonInput, IonItem, IonSegment, IonSegmentButton, IonLabel } from '@ionic/angular/standalone'; import { CloudUser } from 'src/lib/ncloud'; @Component({ selector: 'app-change-key-edit', templateUrl: './change-key.component.html', styleUrls: ['./change-key.component.scss'], standalone: true, imports: [IonHeader, IonToolbar, IonTitle, IonContent, IonCard,IonCardContent,IonButton,IonCardHeader,IonCardTitle,IonCardSubtitle, IonInput,IonItem, IonSegment,IonSegmentButton,IonLabel ], }) export class ChangeKeyComponent implements OnInit { currentUser:CloudUser|undefined userData:any = {} userDataChange(key:string,ev:any){ let value = ev?.detail?.value if(value){ this.userData[key] = value } } constructor( private router: Router, private modalCtrl:ModalController) { this.currentUser = new CloudUser(); this.userData = this.currentUser.data; } ngOnInit() {} async save(){ this.currentUser?.set(this.userData) await this.currentUser?.save() this.modalCtrl.dismiss(this.currentUser,"confirm") this.router.navigate(['/tabs/tab4']) } cancel(){ this.modalCtrl.dismiss(null,"cancel") this.router.navigate(['/tabs/tab4']) } }