1- import { Component } from " @angular/core" ;
2- import { Plugins , StatusBarStyle } from " @capacitor/core" ;
1+ import { Component } from ' @angular/core' ;
2+ import { Plugins , StatusBarStyle } from ' @capacitor/core' ;
33
4- import { BillingDto } from " ../../services/billing/billing.dto" ;
5- import { BillingService } from " ../../services/billing/billing.service" ;
4+ import { BillingDto } from ' ../../services/billing/billing.dto' ;
5+ import { BillingService } from ' ../../services/billing/billing.service' ;
66
7- const { StatusBar } = Plugins ;
7+ const { StatusBar} = Plugins ;
88
99@Component ( {
10- selector : " app-billing" ,
11- templateUrl : " ./billing.page.html" ,
12- styleUrls : [ " ./billing.page.scss" ] ,
10+ selector : ' app-billing' ,
11+ templateUrl : ' ./billing.page.html' ,
12+ styleUrls : [ ' ./billing.page.scss' ] ,
1313} )
1414export class BillingPage {
15- public billings : BillingDto [ ] ;
15+ public billings : BillingDto [ ] = [ ] ;
1616 public currentInvoice : BillingDto ;
1717 public isLoading = true ;
1818 public billingError = false ;
1919
20- constructor ( private billingService : BillingService ) { }
20+ constructor ( private billingService : BillingService ) {
21+ }
2122
2223 ionViewDidEnter ( ) : void {
23- StatusBar . setStyle ( { style : StatusBarStyle . Light } ) ;
24+ StatusBar . setStyle ( { style : StatusBarStyle . Light } ) ;
2425 this . refresh ( )
25- . then ( ( ) => {
26- this . isLoading = false ;
27- } )
2826 . catch ( ( ) => {
29- this . isLoading = false ;
3027 this . billingError = true ;
31- } ) ;
28+ } ) . finally ( ( ) => this . isLoading = false ) ;
3229 }
3330
3431 public doRefresh ( refresher ) {
@@ -43,8 +40,9 @@ export class BillingPage {
4340 }
4441
4542 private async refresh ( ) : Promise < any > {
46- this . billings = await this . billingService . getBillingList ( 100 )
47- this . billings = this . billings . slice ( 1 , this . billings . length ) ;
48- this . currentInvoice = this . billings [ 0 ] ;
43+ const billings = await this . billingService . getBillingList ( 100 ) ;
44+ this . currentInvoice = billings [ 0 ] ;
45+ this . billings = billings . slice ( 1 , billings . length ) ;
46+ console . log ( this . billings )
4947 }
5048}
0 commit comments