Files
WrenchBoardIonic2023/src/app/pages/profile/profile.page.ts
T
CHIEFSOFT\ameye e4473eb956 Fix images
2023-11-06 19:33:53 -05:00

122 lines
3.0 KiB
TypeScript

import { Router } from '@angular/router';
import { Component, OnInit } from '@angular/core';
import { SessionDataProviderService } from 'src/app/store/session-data-provider.service';
import {AlertController} from "@ionic/angular";
@Component({
selector: 'app-profile',
templateUrl: './profile.page.html',
styleUrls: ['./profile.page.scss'],
})
export class ProfilePage implements OnInit {
firstname:string='';
lastname:string='';
email:string='';
profilePicture:string='';
accountType:string="FULL";
constructor(
private router: Router,
private alertController:AlertController,
public sessionDataProviderService:SessionDataProviderService
) {
this.accountType = sessionDataProviderService.account_type;
}
ngOnInit() {
this.firstname = this.sessionDataProviderService.firstname;
this.lastname = this.sessionDataProviderService.lastname;
this.email = this.sessionDataProviderService.username;
this.profilePicture = this.sessionDataProviderService.profilePicture(this.sessionDataProviderService.session, this.sessionDataProviderService.member_uid);
}
onFamily() {
this.router.navigate(['family']);
}
onProfile() {
this.router.navigate(['edit-profile']);
}
onSecurity() {
this.router.navigate(['security']);
}
onNotification() {
this.router.navigate(['notification']);
}
onRewards(){
this.router.navigate(['mycoupons']);
}
onLanguage() {
this.router.navigate(['language']);
}
onPrivacy() {
this.router.navigate(['privacy']);
}
onPayment() {
this.router.navigate(['payment']);
}
onInvite() {
this.router.navigate(['invite']);
}
onMyFiles() {
this.router.navigate(['myfiles']);
}
async onLogout() {
// this.sessionDataProviderService.DestroySessionOnLogout();
// this.router.navigate(['login']);
//this.requestLogout();
const alert = await this.alertController.create({
header: "Log out",
message: "Confirm you are ready to log out now.",
buttons: [
{
text: "Cancel",
role: "cancel",
handler: () => {
// this.getMyOffersData();
},
},
{
text: "Log out",
handler: () => {
this.sessionDataProviderService.DestroySessionOnLogout();
this.router.navigate(['logout']);
},
},
],
});
await alert.present();
}
// async requestLogout() {
// const alert = await this.alertController.create({
// header: "Log out",
// message: "Confirm you are ready to log out now.",
// buttons: [
// {
// text: "Cancel",
// role: "cancel",
// handler: () => {
// // this.getMyOffersData();
// },
// },
// {
// text: "Log out",
// handler: () => {
// this.sessionDataProviderService.DestroySessionOnLogout();
// this.router.navigate(['logout']);
// },
// },
// ],
// });
// await alert.present();
// }
}