diff --git a/src/app/pages/profile/profile.page.html b/src/app/pages/profile/profile.page.html index 02e1db4..91a4fb3 100644 --- a/src/app/pages/profile/profile.page.html +++ b/src/app/pages/profile/profile.page.html @@ -85,7 +85,7 @@ - + Logout diff --git a/src/app/pages/profile/profile.page.ts b/src/app/pages/profile/profile.page.ts index 5708ec5..4b5569f 100644 --- a/src/app/pages/profile/profile.page.ts +++ b/src/app/pages/profile/profile.page.ts @@ -56,7 +56,8 @@ export class ProfilePage implements OnInit { onMyFiles() { this.router.navigate(['myfiles']); } - onLogin() { + onLogout() { + this.sessionDataProviderService.DestroySessionOnLogout(); this.router.navigate(['login']); } diff --git a/src/app/pages/security/security.page.ts b/src/app/pages/security/security.page.ts index 93131b7..cb3aa5b 100644 --- a/src/app/pages/security/security.page.ts +++ b/src/app/pages/security/security.page.ts @@ -1,6 +1,8 @@ import { NavController } from '@ionic/angular'; import { Component, OnInit } from '@angular/core'; +import { SessionDataProviderService } from 'src/app/store/session-data-provider.service'; +import { Router } from '@angular/router'; @Component({ selector: 'app-security', @@ -10,7 +12,9 @@ import { Component, OnInit } from '@angular/core'; export class SecurityPage implements OnInit { constructor( - private navctr: NavController + private navctr: NavController, + private router: Router, + public sessionDataProviderService:SessionDataProviderService ) { } ngOnInit() { @@ -23,6 +27,11 @@ export class SecurityPage implements OnInit { requestDeleteResult:string = ''; requestDelete(){ this.requestDeleteResult = "Received"; + this.onLogout(); } + onLogout() { + this.sessionDataProviderService.DestroySessionOnLogout(); + this.router.navigate(['login']); + } } diff --git a/src/app/store/session-data-provider.service.ts b/src/app/store/session-data-provider.service.ts index c4660fa..d79a3a5 100644 --- a/src/app/store/session-data-provider.service.ts +++ b/src/app/store/session-data-provider.service.ts @@ -105,6 +105,22 @@ export class SessionDataProviderService { return this.session_contructed; } + DestroySessionOnLogout(){ + console.log('Hello DestroySessionOnLogout Provider'); + this.firstname = ""; + this.lastname = ""; + this.session = "INVALID"; + this.session_contructed= false; + this.username=""; + this.last_login = ""; + this.member_id = -1; + this.member_uid = ""; + this.balance = -1; + this.ccard= 0; + this.profile_pic=""; + this.isPedningJob = 0; + this.isOfferJob = 0; + } profilePicture(){ var profile_p = ''; if (this.profile_pic !=''){