File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 My Bills
55 </ ion-title >
66 < ion-buttons end >
7+ < button ion-button color ="danger " (click) ="logoutNow() "> Logout
8+ </ button >
79 < button ion-button icon-only (click) ="createBill() ">
810 < ion-icon name ="add "> </ ion-icon >
911 </ button >
@@ -40,4 +42,4 @@ <h3>Total:
4042 </ h3 >
4143 </ ion-item >
4244 </ ion-list >
43- </ ion-content >
45+ </ ion-content >
Original file line number Diff line number Diff line change @@ -3,10 +3,13 @@ import {
33 NavController ,
44 ActionSheet ,
55 ActionSheetController ,
6+ Loading ,
7+ LoadingController ,
68 Platform
79} from 'ionic-angular' ;
810import { Observable } from 'rxjs/Observable' ;
911import { BillProvider } from '../../providers/bill/bill' ;
12+ import { AuthProvider } from '../../providers/auth/auth' ;
1013
1114@Component ( {
1215 selector : 'page-home' ,
@@ -17,8 +20,10 @@ export class HomePage {
1720 constructor (
1821 public navCtrl : NavController ,
1922 public actionCtrl : ActionSheetController ,
23+ public loadingCtrl : LoadingController ,
2024 public platform : Platform ,
21- public billProvider : BillProvider
25+ public billProvider : BillProvider ,
26+ public authProvider : AuthProvider
2227 ) { }
2328
2429 ionViewDidLoad ( ) {
@@ -72,4 +77,21 @@ export class HomePage {
7277 action . present ( ) ;
7378 }
7479
80+ logoutNow ( ) : void {
81+ this . authProvider . logoutUser ( ) . then ( newUser => {
82+ loading . dismiss ( ) . then ( ( ) => {
83+ this . navCtrl . setRoot ( LandingPage ) ;
84+ } ) ;
85+ } ) . catch ( error => {
86+ loading . dismiss ( ) . then ( ( ) => {
87+ console . error ( "logoutNow " , error ) ;
88+ } ) ;
89+ } ) ;
90+
91+ const loading : Loading = this . loadingCtrl . create ( ) ;
92+ loading . present ( ) ;
93+
94+ //this.navCtrl.push('LandingPage');
95+ }
96+
7597}
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ export class LoginPage {
5555 error => {
5656 this . loading . dismiss ( ) . then ( ( ) => {
5757 const alert : Alert = this . alertCtrl . create ( {
58- message : error . message ,
58+ message : 'loginUser ' + error . message ,
5959 buttons : [
6060 {
6161 text : 'OK' ,
You can’t perform that action at this time.
0 commit comments