Refactor customer graph to use new service for org graphs
This commit is contained in:
parent
7342db0713
commit
5e2471aebf
5 changed files with 41 additions and 10 deletions
|
@ -18,6 +18,16 @@ export class ApiService {
|
|||
}
|
||||
}
|
||||
|
||||
public post(url, data) {
|
||||
if ( this.sessionKey != null ) {
|
||||
data.session_key = this.sessionKey;
|
||||
}
|
||||
return this.http.post(
|
||||
this.apiUrl + url,
|
||||
data
|
||||
).map( response => response.json() );
|
||||
}
|
||||
|
||||
// Login API
|
||||
|
||||
private getSessionKey() {
|
||||
|
|
13
src/app/providers/org-graphs.service.ts
Normal file
13
src/app/providers/org-graphs.service.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { ApiService } from './api-service';
|
||||
|
||||
@Injectable()
|
||||
export class OrgGraphsService {
|
||||
private orgGraphUrl = '/v1/organisation/graphs';
|
||||
|
||||
constructor(private api: ApiService) { }
|
||||
|
||||
public getGraph(name: string) {
|
||||
return this.api.post(this.orgGraphUrl, { graph: name });
|
||||
}
|
||||
}
|
Reference in a new issue