From a0e077852ddb067f7a8ef40dba90690bfc5b3d94 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 7 Sep 2017 15:36:19 +0100 Subject: [PATCH] Change to using new api for snippets --- src/app/providers/org-snippets.service.ts | 9 +-------- src/app/snippets/org-snippet-bar.component.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 16 deletions(-) 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; } ); }