Change to using new api for snippets

This commit is contained in:
Tom Bloor 2017-09-07 15:36:19 +01:00
parent 20da5f1e92
commit a0e077852d
2 changed files with 9 additions and 16 deletions

View file

@ -9,13 +9,6 @@ export class OrgSnippetsService {
constructor(private api: ApiService) { } constructor(private api: ApiService) { }
public getData(): Observable<any> { public getData(): Observable<any> {
return Observable.of( return this.api.post(this.orgSnippetsUrl);
{
'customersthismonth' : 196,
'moneyspentthismonth' : 156.02,
'pointstotal' : 506,
'averagetransactiontoday' : 3.69
}
);
} }
} }

View file

@ -7,10 +7,10 @@ import { OrgSnippetsService } from '../providers/org-snippets.service';
}) })
export class OrgBarSnippetComponent implements OnInit { export class OrgBarSnippetComponent implements OnInit {
public customersThisMonth: number; public customersThisMonth = 0;
public moneySpentThisMonth: number; public moneySpentThisMonth = 0;
public pointsTotal: number; public pointsTotal = 0;
public averageTransactionToday: number; public averageTransactionToday = 0;
constructor( constructor(
private snippetsService: OrgSnippetsService, private snippetsService: OrgSnippetsService,
@ -20,10 +20,10 @@ export class OrgBarSnippetComponent implements OnInit {
this.snippetsService.getData() this.snippetsService.getData()
.subscribe( .subscribe(
result => { result => {
this.customersThisMonth = result.customersthismonth; this.customersThisMonth = result.snippets.this_month_customer_count;
this.moneySpentThisMonth = result.moneyspentthismonth; this.moneySpentThisMonth = result.snippets.this_month_customer_spend;
this.pointsTotal = result.pointstotal; this.pointsTotal = result.snippets.pear_points_total;
this.averageTransactionToday = result.averagetransactiontoday; this.averageTransactionToday = result.snippets.today_sales_average;
} }
); );
} }