Refactor customer graph to use new service for org graphs

This commit is contained in:
Tom Bloor 2017-08-29 17:39:27 +01:00
parent 7342db0713
commit 5e2471aebf
5 changed files with 41 additions and 10 deletions

View file

@ -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() {

View 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 });
}
}