feat(client): POST client address && fix(client): fixed sorting and pagination in view clients (#115)

* feat(client): POST client address && fix(client): fixed sorting and pagination in view clients
This commit is contained in:
Anwesh Nayak
2018-07-11 06:01:03 +05:30
committed by GitHub
parent 340598b540
commit 63925a37c3
12 changed files with 330 additions and 58 deletions
+42 -1
View File
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Http, Headers, Response } from '@angular/http';
import { Http, Headers, Response, RequestOptions, URLSearchParams } from '@angular/http';
/* import { HttpHeaders, HttpClient } from '@angular/common/http';
*/
import { Observable } from 'rxjs';
@@ -141,4 +141,45 @@ export class ClientsService {
)
);
}
getClientAddressTemplate() {
const headers = new Headers(); // tslint:disable-line
this.createAuthorizationHeader(headers);
return this.http.get
('https://demo.openmf.org/fineract-provider/api/v1/client/'
+ 'addresses/template?tenantIdentifier=default',
{headers: headers})
.pipe(
map(
(response: Response) => { // tslint:disable-line
response = response.json();
return response;
}
)
);
}
postClientAddress (clientId: number, body: any, type: any) {
const headers = new Headers(); // tslint:disable-line
const params = new URLSearchParams(); // tslint:disable-line
params.set('type', type);
this.createAuthorizationHeader(headers);
body = JSON.stringify(body);
const options = new RequestOptions({ // tslint:disable-line
headers: headers,
params: params,
});
return this.http.post
('https://demo.openmf.org/fineract-provider/api/v1/client/' + clientId
+ '/addresses?' + '&tenantIdentifier=default&pretty=true', body ,
options)
.pipe(
map(
(response: Response) => { // tslint:disable-line
response.json();
}
)
);
}
}