diff --git a/src/app/providers/org-snippets.service.ts b/src/app/providers/org-snippets.service.ts index 310143d..a3849ef 100644 --- a/src/app/providers/org-snippets.service.ts +++ b/src/app/providers/org-snippets.service.ts @@ -9,13 +9,6 @@ export class OrgSnippetsService { constructor(private api: ApiService) { } public getData(): Observable { - return Observable.of( - { - 'customersthismonth' : 196, - 'moneyspentthismonth' : 156.02, - 'pointstotal' : 506, - 'averagetransactiontoday' : 3.69 - } - ); + return this.api.post(this.orgSnippetsUrl); } } diff --git a/src/app/snippets/org-snippet-bar.component.ts b/src/app/snippets/org-snippet-bar.component.ts index eed36b8..a545202 100644 --- a/src/app/snippets/org-snippet-bar.component.ts +++ b/src/app/snippets/org-snippet-bar.component.ts @@ -7,10 +7,10 @@ import { OrgSnippetsService } from '../providers/org-snippets.service'; }) export class OrgBarSnippetComponent implements OnInit { - public customersThisMonth: number; - public moneySpentThisMonth: number; - public pointsTotal: number; - public averageTransactionToday: number; + public customersThisMonth = 0; + public moneySpentThisMonth = 0; + public pointsTotal = 0; + public averageTransactionToday = 0; constructor( private snippetsService: OrgSnippetsService, @@ -20,10 +20,10 @@ export class OrgBarSnippetComponent implements OnInit { this.snippetsService.getData() .subscribe( result => { - this.customersThisMonth = result.customersthismonth; - this.moneySpentThisMonth = result.moneyspentthismonth; - this.pointsTotal = result.pointstotal; - this.averageTransactionToday = result.averagetransactiontoday; + this.customersThisMonth = result.snippets.this_month_customer_count; + this.moneySpentThisMonth = result.snippets.this_month_customer_spend; + this.pointsTotal = result.snippets.pear_points_total; + this.averageTransactionToday = result.snippets.today_sales_average; } ); }